Revision 440ad8d3
Von Thomas Heck vor etwa 12 Jahren hinzugefügt
SL/Layout/None.pm | ||
---|---|---|
js/jquery.js
|
||
js/common.js
|
||
js/namespace.js
|
||
js/kivi.js
|
||
),
|
||
'js/locale/'. $::myconfig{countrycode} .'.js',
|
||
$self->SUPER::use_javascript(@_);
|
||
}
|
||
|
js/kivi.js | ||
---|---|---|
namespace("kivi", function(ns) {
|
||
|
||
ns._localeLang = false;
|
||
ns._locales = {};
|
||
ns._locale = {};
|
||
|
||
ns.t8 = function(text, params) {
|
||
if( ns._localeLang ) {
|
||
if( !ns._locales[ns._localeLang] ) {
|
||
ns._locales[ns._localeLang] = {};
|
||
|
||
jQuery.ajax({
|
||
url: "js/locale/"+ ns._localeLang +".js",
|
||
async: false,
|
||
dataType: "json",
|
||
success: function(res) {
|
||
ns._locales[ns._localeLang] = res;
|
||
},
|
||
});
|
||
}
|
||
|
||
text = ns._locales[ns._localeLang][text] || text;
|
||
}
|
||
var text = ns._locale[text] || text;
|
||
|
||
if( Object.prototype.toString.call( params ) === '[object Array]' ) {
|
||
var len = params.length;
|
||
... | ... | |
return text;
|
||
};
|
||
|
||
ns.initLocale = function(localeLang) {
|
||
ns._localeLang = localeLang;
|
||
ns.setupLocale = function(locale) {
|
||
ns._locale = locale;
|
||
};
|
||
|
||
});
|
||
|
||
kivi = namespace('kivi');
|
js/locale/de.js | ||
---|---|---|
{
|
||
}
|
||
namespace("kivi").setupLocale({
|
||
});
|
scripts/locales.pl | ||
---|---|---|
);
|
||
|
||
open(my $js_file, '>:encoding(utf8)', $javascript_output_dir .'/locale/'. $locale .'.js') || die;
|
||
print $js_file '{';
|
||
print $js_file 'namespace("kivi").setupLocale({';
|
||
my $first_entry = 1;
|
||
for my $key (sort(keys(%jslocale))) {
|
||
print $js_file ((!$first_entry ? ',' : '') ."\n". _double_quote($key) .':'. _double_quote($self->{texts}{$key}));
|
||
$first_entry = 0;
|
||
}
|
||
print $js_file ("\n".'}'."\n");
|
||
print $js_file ("\n");
|
||
print $js_file ('});'."\n");
|
||
close($js_file);
|
||
|
||
foreach my $text (keys %$missing) {
|
templates/webpages/layout/javascript_setup.js | ||
---|---|---|
[%- USE T8 %]
|
||
$(function() {
|
||
[% IF datefmt %]
|
||
namespace("kivi").initLocale("[% MYCONFIG.countrycode | html %]");
|
||
setupPoints('[% MYCONFIG.numberformat %]', '[% 'wrongformat' | $T8 %]');
|
||
setupDateFormat('[% MYCONFIG.dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]');
|
||
|
Auch abrufbar als: Unified diff
JS-Übersetzung immer in HEAD laden