From: levinse Date: Fri, 3 Jun 2011 22:47:20 +0000 (+0000) Subject: internationalization/localization, RT12515 X-Git-Tag: freeside_2_3_0~178 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=db303b2cb273b45e03467f36e076b7c1db3bc4a4 internationalization/localization, RT12515 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 186d82878..eaa6a3de3 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4458,6 +4458,18 @@ and customer address. Include units.', 'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.', 'type' => 'checkbox', }, + + { + 'key' => 'translate-auto-insert', + 'section' => '', + 'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values. DO NOT TURN THIS ON.', + 'type' => 'select-sub', + 'multiple' => 1, + 'options_sub' => sub { map { $_ => '' } + grep { $_ ne 'en_US' } FS::Locales::locales; + }, + 'option_sub' => sub { ''; }, + }, { key => "apacheroot", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, diff --git a/FS/FS/Msgcat.pm b/FS/FS/Msgcat.pm index e111f4e8c..242980515 100644 --- a/FS/FS/Msgcat.pm +++ b/FS/FS/Msgcat.pm @@ -74,6 +74,18 @@ sub _gettext { warn "WARNING: message for msgcode $msgcode in locale $locale not found" unless $locale eq 'en_US'; $cache{$locale}->{$msgcode} = $msgcode; + + my @translate_auto_insert = $conf->config('translate-auto-insert'); + if ( $locale ne 'en_US' && grep { $_ eq $locale } @translate_auto_insert ) { + + # :( + my $newmsgcat = new FS::Record('msgcat', { locale => $locale, + msgcode => $msgcode, + msg => $msgcode, + }); + warn "WARNING: auto-inserting message for msgcode $msgcode in locale $locale"; + $newmsgcat->insert; + } } }