projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9f42fa8
)
internationalization/localization, RT12515
author
levinse
<levinse>
Fri, 3 Jun 2011 22:47:20 +0000
(22:47 +0000)
committer
levinse
<levinse>
Fri, 3 Jun 2011 22:47:20 +0000
(22:47 +0000)
FS/FS/Conf.pm
patch
|
blob
|
history
FS/FS/Msgcat.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Conf.pm
b/FS/FS/Conf.pm
index
186d828
..
eaa6a3d
100644
(file)
--- 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',
},
'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" },
{ 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
e111f4e
..
2429805
100644
(file)
--- 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;
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;
+ }
}
}
}
}