[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Default language


Elver Loho writes:
Hiya! catalog.cfg has the following:
# Last locale specified is the default.
Locale          en_US LC_CTYPE C
Locale en_US currency_symbol
LocaleDatabase  locale
DefaultLocale en_US
ScratchDefault mv_locale en_US
Situation: The language variable is set to 'rus'. On the page there
exists [L code]blah[/L] In the database for the entry 'code' we have
en_US='foobar' but no 'rus'.
What we want: It should fall back to the en_US field for 'code' and
therefore display 'foobar'.
What it does: Is fall back to the string between the L tags and it
displays 'blah'.
I hope that was more clear.

Yes it was and in the current IC code this is not how appears to be solved. It falls back to the message in between the [L] [/L] .. Your theory I think is having a point, that you would perhaps expect to fall back to the DefaultLocale. This could be done by patching lib/Vend/Util.pm. Because of lack of time here's how I did it (no warranties whatsoever :)):
search for the first [L  - you should get to the following line:
$$r =~ s~\[L(\s+([^\]]+))?\]([\000-\377]*?)\[/L\]~ The block in this area I have changed to:
              my ($key,$trans);
              $$r =~ s~\[L(\s+([^\]]+))?\]([\000-\377]*?)\[/L\]~
                      $key = $2 || $3;
if (defined $Vend::Cfg->{Locale_repository}{($Vend::Cfg->{DefaultLocale})}{$key}) { $trans = $Vend::Cfg->{Locale_repository}{($Vend::Cfg->{DefaultLocale})}{$key};
                      }
                      else {
                              $trans = $3;
                      }
defined $Vend::Cfg->{Locale}{$key} ? ($Vend::Cfg->{Locale}{$key}) : $trans ~eg; I'm sure someone can do this much more elegantly to find the default translation for something and use that instead of the message. CU,
Gert
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.