updatelang: Extract langstr ignore list into a separate file so it can be shared

Change-Id: I4b77e1fe435e1f02df665f18e69b5c1db0a2e0b5
This commit is contained in:
Solomon Peachy 2020-07-28 11:11:30 -04:00
parent 2aeeeb43c9
commit 530bc16679
2 changed files with 91 additions and 84 deletions

74
tools/langignorelist.txt Normal file
View file

@ -0,0 +1,74 @@
# This file containes LANG_IDs for which it is okay to be
# identical to their English source.
# one LANG_ or VOICE_ per line, no whitespace!
LANG_SERIAL_BITRATE_9600
LANG_SERIAL_BITRATE_19200
LANG_SERIAL_BITRATE_38400
LANG_SERIAL_BITRATE_57600
LANG_COMPRESSOR_RATIO_10
LANG_COMPRESSOR_RATIO_2
LANG_COMPRESSOR_RATIO_6
LANG_COMPRESSOR_RATIO_4
LANG_ROCKBOX_TITLE
LANG_EQUALIZER_BAND_Q
LANG_FM_DEFAULT_PRESET_NAME
LANG_COLOR_RGB_LABELS
LANG_BYTE
LANG_KIBIBYTE
LANG_GIBIBYTE
LANG_USB_HID
VOICE_ZERO
VOICE_ONE
VOICE_TWO
VOICE_THREE
VOICE_FOUR
VOICE_FIVE
VOICE_SIX
VOICE_SEVEN
VOICE_EIGHT
VOICE_NINE
VOICE_TEN
VOICE_ELEVEN
VOICE_TWELVE
VOICE_THIRTEEN
VOICE_FOURTEEN
VOICE_FIFTEEN
VOICE_SIXTEEN
VOICE_SEVENTEEN
VOICE_EIGHTEEN
VOICE_NINETEEN
VOICE_TWENTY
VOICE_THIRTY
VOICE_FORTY
VOICE_FIFTY
VOICE_SIXTY
VOICE_SEVENTY
VOICE_EIGHTY
VOICE_NINETY
VOICE_CHAR_A
VOICE_CHAR_B
VOICE_CHAR_C
VOICE_CHAR_D
VOICE_CHAR_E
VOICE_CHAR_F
VOICE_CHAR_G
VOICE_CHAR_H
VOICE_CHAR_I
VOICE_CHAR_J
VOICE_CHAR_K
VOICE_CHAR_L
VOICE_CHAR_M
VOICE_CHAR_N
VOICE_CHAR_O
VOICE_CHAR_P
VOICE_CHAR_Q
VOICE_CHAR_R
VOICE_CHAR_S
VOICE_CHAR_T
VOICE_CHAR_U
VOICE_CHAR_V
VOICE_CHAR_W
VOICE_CHAR_X
VOICE_CHAR_Y
VOICE_CHAR_Z
VOICE_PAUSE

View file

@ -111,93 +111,10 @@ sub combinetgts {
return %combined;
}
my @ignorelist = split("\n",
"LANG_SERIAL_BITRATE_19200
LANG_SERIAL_BITRATE_9600
LANG_SERIAL_BITRATE_38400
LANG_SERIAL_BITRATE_57600
LANG_COMPRESSOR_RATIO_10
LANG_COMPRESSOR_RATIO_2
LANG_COMPRESSOR_RATIO_6
LANG_COMPRESSOR_RATIO_4
LANG_ROCKBOX_TITLE
LANG_EQUALIZER_BAND_Q
LANG_FM_DEFAULT_PRESET_NAME
LANG_DISK_NAME_MMC
LANG_COLOR_RGB_LABELS
LANG_BYTE
LANG_KIBIBYTE
LANG_GIBIBYTE
LANG_USB_HID
VOICE_ZERO
VOICE_ONE
VOICE_TWO
VOICE_THREE
VOICE_FOUR
VOICE_FIVE
VOICE_SIX
VOICE_SEVEN
VOICE_EIGHT
VOICE_NINE
VOICE_TEN
VOICE_ELEVEN
VOICE_TWELVE
VOICE_THIRTEEN
VOICE_FOURTEEN
VOICE_FIFTEEN
VOICE_SIXTEEN
VOICE_SEVENTEEN
VOICE_EIGHTEEN
VOICE_NINETEEN
VOICE_TWENTY
VOICE_THIRTY
VOICE_FORTY
VOICE_FIFTY
VOICE_SIXTY
VOICE_SEVENTY
VOICE_EIGHTY
VOICE_NINETY
VOICE_CHAR_A
VOICE_CHAR_B
VOICE_CHAR_C
VOICE_CHAR_D
VOICE_CHAR_E
VOICE_CHAR_F
VOICE_CHAR_G
VOICE_CHAR_H
VOICE_CHAR_I
VOICE_CHAR_J
VOICE_CHAR_K
VOICE_CHAR_L
VOICE_CHAR_M
VOICE_CHAR_N
VOICE_CHAR_O
VOICE_CHAR_P
VOICE_CHAR_Q
VOICE_CHAR_R
VOICE_CHAR_S
VOICE_CHAR_T
VOICE_CHAR_U
VOICE_CHAR_V
VOICE_CHAR_W
VOICE_CHAR_X
VOICE_CHAR_Y
VOICE_CHAR_Z
VOICE_PAUSE");
sub not_ignorelist {
my ($key) = @_;
foreach (@ignorelist) {
if ($_ eq $key) {
return 0;
}
}
return 1;
}
##################
if($#ARGV != 2) {
print "Usage: updatelang <english.lang> <otherlang> [<outfile>|-]\n";
print "Usage: updatelang <english.lang> <otherlang> <outfile|->\n";
exit;
}
@ -223,6 +140,22 @@ my $f1 = $tmp[0];
my $f2 = $tmp[0];
undef @tmp;
# Read in ignore list
my $igname = dirname($0) . "/langignorelist.txt";
open (FH, "<$igname") || die ("Can't open $igname!");
my @ignorelist = <FH>;
close (FH);
sub not_ignorelist {
my ($key) = @_;
foreach (@ignorelist) {
if ($_ eq $key) {
return 0;
}
}
return 1;
}
undef $igname;
# Do we care about notes?
my $printnotes = 1;
my $ignoredups = 0;