Bugzilla – Bug 4828
add support for regional languages ("English (US)", "Español (Mexico)", etc.)
Last modified: 2011-11-06 23:23:55 UTC
There's a new plugin that Michael Herger is hosting called TimeSpeller, which is a Date and Time screensaver that prints the time in words, e.g. "quarter to ten". The English translation of this is British English ("midday" rather than "noon"). It would be nice to have regional subtypes for such plugins. I'm thinking something like using hyphenated names for regional subtypes -- "EN-US" for "English (US)", "EN-UK" for "English (Britain)", "ES-MX" for "Español (Mexico)", etc. If a user chose a subtype like ES-MX, Slimserver would look first for "ES-MX" strings, then "ES", and only then look at the failsafe language. sample patches for 6.5.0: --- strings.txt 2007/03/14 01:59:22 1.1 +++ strings.txt 2007/03/14 02:02:58 @@ -110,6 +110,7 @@ DE Deutsch DA Dansk EN English + EN-US English (US) ES Español FI Suomi FR Français --- Slim/Utils/Strings.pm 2007/03/14 01:57:44 1.1 +++ Slim/Utils/Strings.pm 2007/03/14 02:18:50 @@ -190,6 +190,10 @@ my $currentLanguage = getLanguage(); my $failSafeLanguage = failsafeLanguage(); + my $superLanguage = $currentLanguage; + if ( $currentLanguage =~ m|^(.{1,})\-.*$| ) { + $superLanguage = $1; + } LINE: for my $line (split('\n', $$strings)) { @@ -218,9 +222,8 @@ } # /TEMP - # only read strings in our preferred and the failback language - plus the language names for the setup page - if ($one ne $failSafeLanguage && $one ne $currentLanguage && $stringname ne 'LANGUAGE_CHOICES') { + # only read strings in our preferred and super-region and the failback language - plus the language names for the setup page + if ($one ne $failSafeLanguage && $one ne $currentLanguage && $stringname ne 'LANGUAGE_CHOICES' && $one ne $superLanguage ) { next LINE; } @@ -283,7 +286,15 @@ my $translate = Slim::Utils::Prefs::get('plugin-stringeditor-translatormode') || 0; - for my $tryLang ($language, $failsafe_language) { + my @languages = (); + push @languages, $language; + if ( $language =~ m|^(.{1,})\-.*$| ) { + # chosen language is a subtype; look in primary before looking at failsafe + push @languages, $1; + } + push @languages, $failsafe_language; + + for my $tryLang (@languages) { if (!$strings{$stringname}->{$tryLang}) { next;
Created attachment 1850 [details] Simple patch for trunk
Created attachment 1851 [details] Even simpler patch for trunk Only check for super language, if current language is not defined
Just a side note: this use case isn't limited to that plugin. I've been using Swiss German interpretation of the great Duden all over the place. This can be slightly different from the German spelling. I'd have translated some of these strings differently if I had the chance to differentiate the two. For now our German friends have to live with my Swiss German influence :-). But the TimeSpeller is one pretty nice case: I'd know at least three (or even four) different ways to spell eg. 9h45, depending on if you're German from the north, rather Bavarian, Swiss or Austrian.
*** Bug 13035 has been marked as a duplicate of this bug. ***
Unassigned bugs cannot have a priority.