diff options
author | levinse <levinse> | 2011-06-03 22:47:20 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-03 22:47:20 +0000 |
commit | db303b2cb273b45e03467f36e076b7c1db3bc4a4 (patch) | |
tree | 6e2496487a9414a4c379444316d59b13599951a4 | |
parent | 9f42fa8fb7cb27deb5f249ffc3ce334de545c580 (diff) |
internationalization/localization, RT12515
-rw-r--r-- | FS/FS/Conf.pm | 12 | ||||
-rw-r--r-- | FS/FS/Msgcat.pm | 12 |
2 files changed, 24 insertions, 0 deletions
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 => "<b>DEPRECATED</b>", type => "text" }, { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", 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; + } } } |