mirror of
https://git.code.sf.net/p/zint/code
synced 2025-06-08 02:14:53 -04:00
First attempt at i18n using gettext
This commit is contained in:
parent
44923349f3
commit
06058d7518
45 changed files with 1236 additions and 356 deletions
|
@ -316,7 +316,8 @@ INTERNAL int code_128(struct zint_symbol *symbol, const unsigned char source[],
|
|||
if (sourcelen > C128_MAX) {
|
||||
/* This only blocks ridiculously long input - the actual length of the
|
||||
resulting barcode depends on the type of data, so this is trapped later */
|
||||
strcpy(symbol->errtxt, "340: Input too long");
|
||||
symbol->err_origin = 340;
|
||||
strcpy(symbol->errtxt, _("Input too long"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
@ -479,7 +480,8 @@ INTERNAL int code_128(struct zint_symbol *symbol, const unsigned char source[],
|
|||
}
|
||||
}
|
||||
if (glyph_count > 60.0) {
|
||||
strcpy(symbol->errtxt, "341: Input too long");
|
||||
symbol->err_origin = 341;
|
||||
strcpy(symbol->errtxt, _("Input too long"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
@ -720,7 +722,8 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const s
|
|||
if (length > C128_MAX) {
|
||||
/* This only blocks ridiculously long input - the actual length of the
|
||||
resulting barcode depends on the type of data, so this is trapped later */
|
||||
strcpy(symbol->errtxt, "342: Input too long");
|
||||
symbol->err_origin = 342;
|
||||
strcpy(symbol->errtxt, _("Input too long"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
@ -851,7 +854,8 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const s
|
|||
}
|
||||
}
|
||||
if (glyph_count > 60.0) {
|
||||
strcpy(symbol->errtxt, "344: Input too long");
|
||||
symbol->err_origin = 344;
|
||||
strcpy(symbol->errtxt, _("Input too long"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
@ -1030,13 +1034,15 @@ INTERNAL int nve_18(struct zint_symbol *symbol, unsigned char source[], int leng
|
|||
sourcelen = length;
|
||||
|
||||
if (sourcelen > 17) {
|
||||
strcpy(symbol->errtxt, "345: Input too long");
|
||||
symbol->err_origin = 345;
|
||||
strcpy(symbol->errtxt, _("Input too long"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "346: Invalid characters in data");
|
||||
symbol->err_origin = 346;
|
||||
strcpy(symbol->errtxt, _("Invalid character in data"));
|
||||
return error_number;
|
||||
}
|
||||
zeroes = 17 - sourcelen;
|
||||
|
@ -1071,13 +1077,15 @@ INTERNAL int ean_14(struct zint_symbol *symbol, unsigned char source[], int leng
|
|||
unsigned char ean128_equiv[20];
|
||||
|
||||
if (length > 13) {
|
||||
strcpy(symbol->errtxt, "347: Input wrong length");
|
||||
symbol->err_origin = 347;
|
||||
strcpy(symbol->errtxt, _("Input wrong length"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "348: Invalid character in data");
|
||||
symbol->err_origin = 348;
|
||||
strcpy(symbol->errtxt, _("Invalid character in data"));
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1117,7 +1125,8 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int
|
|||
int cd; // Check digit
|
||||
|
||||
if (length != 28) {
|
||||
strcpy(symbol->errtxt, "349: DPD input wrong length");
|
||||
symbol->err_origin = 349;
|
||||
strcpy(symbol->errtxt, _("Input wrong length"));
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
@ -1127,12 +1136,14 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int
|
|||
to_upper(source);
|
||||
error_number = is_sane(KRSET, source, length);
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "350: Invalid character in DPD data");
|
||||
symbol->err_origin = 350;
|
||||
strcpy(symbol->errtxt, _("Invalid character in data"));
|
||||
return error_number;
|
||||
}
|
||||
|
||||
if ((identifier < 32) || (identifier > 127)) {
|
||||
strcpy(symbol->errtxt, "351: Invalid DPD identifier");
|
||||
symbol->err_origin = 351;
|
||||
strcpy(symbol->errtxt, _("Invalid DPD identifier"));
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue