[ic] Default language
Mike Heins
mike at perusion.com
Wed Mar 8 16:05:35 EST 2006
Quoting Gert van der Spoel (ic at 3edge.com):
> 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.
That would be a significant performance hit, which is why
it is not done that way. If someone were to change it, they
should make it dependent on a configuration setting.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
Find the grain of truth in criticism, chew it, and swallow
it. -- anonymous
More information about the interchange-users
mailing list