Bug 4828 - add support for regional languages ("English (US)", "Español (Mexico)", etc.)
: add support for regional languages ("English (US)", "Español (Mexico)", etc.)
Status: NEW
Product: Logitech Media Server
Classification: Unclassified
Component: Localization
: unspecified
: All Other
: -- enhancement with 1 vote (vote)
: Future
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-13 19:20 UTC by Peter Watkins
Modified: 2011-11-06 23:23 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments
Simple patch for trunk (850 bytes, patch)
2007-03-21 02:21 UTC, Michael Herger
Details | Diff
Even simpler patch for trunk (742 bytes, patch)
2007-03-21 02:31 UTC, Michael Herger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Watkins 2007-03-13 19:20:36 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;
Comment 1 Michael Herger 2007-03-21 02:21:50 UTC
Created attachment 1850 [details]
Simple patch for trunk
Comment 2 Michael Herger 2007-03-21 02:31:13 UTC
Created attachment 1851 [details]
Even simpler patch for trunk

Only check for super language, if current language is not defined
Comment 3 Michael Herger 2007-03-21 05:45:41 UTC
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.
Comment 4 Michael Herger 2009-07-27 00:24:28 UTC
*** Bug 13035 has been marked as a duplicate of this bug. ***
Comment 5 Alan Young 2011-11-06 23:23:55 UTC
Unassigned bugs cannot have a priority.