BUG 0000 Feature: Adding the translation Js javascript _()

- available on leimud env.
This commit is contained in:
Erik Amaru Ortiz
2012-04-03 20:04:28 -04:00
parent f38d82c209
commit 852c0836ce
2 changed files with 36 additions and 5 deletions

View File

@@ -2083,3 +2083,33 @@ function elementAttributesNS(e, ns)
return result;
}
/**
* Translator function for internationalization
*/
function _()
{
var argv = _.arguments;
var argc = argv.length;
if( typeof TRANSLATIONS != 'undefined' && TRANSLATIONS) {
if( typeof TRANSLATIONS[argv[0]] != 'undefined' ) {
if (argc > 1) {
trn = TRANSLATIONS[argv[0]];
for (i = 1; i < argv.length; i++) {
trn = trn.replace('{'+(i-1)+'}', argv[i]);
}
}
else {
trn = TRANSLATIONS[argv[0]];
}
}
else {
trn = '**' + argv[0] + '**';
}
}
else {
PMExt.error('Processmaker JS Core Error', 'The TRANSLATIONS global object is not loaded!');
trn = '';
}
return trn;
}

View File

@@ -304,6 +304,7 @@ class headPublisher {
function getExtJsStylesheets($skinName){
$script = " <link rel='stylesheet' type='text/css' href='/css/$skinName.css' />\n";
$script .= " <script type='text/javascript' src='/js/ext/translation.en.js'></script>\n";
/*
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/ext-all-notheme.css' />\n";
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/" . $this->extJsSkin.".css' />\n";
@@ -321,11 +322,11 @@ class headPublisher {
// Load external/plugin css
// NOTE is necesary to move this to decorator server
if(class_exists('PMPluginRegistry')){
$oPluginRegistry = & PMPluginRegistry::getSingleton ();
$registeredCss=$oPluginRegistry->getRegisteredCss();
foreach($registeredCss as $cssFile){
$script .= " <link rel='stylesheet' type='text/css' href='" . $cssFile->sCssFile . ".css' />\n";
}
$oPluginRegistry = & PMPluginRegistry::getSingleton ();
$registeredCss=$oPluginRegistry->getRegisteredCss();
foreach($registeredCss as $cssFile){
$script .= " <link rel='stylesheet' type='text/css' href='" . $cssFile->sCssFile . ".css' />\n";
}
}
return $script;