* Translated strings: array(string $orig => string $translated).
*/
public function getTranslatedStrings($name) {
+ $module = $this->getModule($name);
$result = array();
$strings = $this->getStrings($name);
foreach ($strings as $string) {
// TODO: should we pass translation domain based on $module[ext] or $module[tsDomain]?
// It doesn't look like client side really supports the domain right now...
- $translated = ts($string);
+ $translated = ts($string, array(
+ 'domain' => array($module['ext'], NULL),
+ ));
if ($translated != $string) {
$result[$string] = $translated;
}
foreach ($moduleNames as $moduleName) {
if (isset($modules[$moduleName])) {
$result[$moduleName] = array();
+ $result[$moduleName]['domain'] = $modules[$moduleName]['ext'];
$result[$moduleName]['js'] = $angular->getScriptUrls($moduleName);
$result[$moduleName]['css'] = $angular->getStyleUrls($moduleName);
$result[$moduleName]['partials'] = $angular->getPartials($moduleName);
};
};
+ CRM.addStrings = function(domain, strings) {
+ var bucket = (domain == 'civicrm' ? 'strings' : 'strings::' + domain);
+ CRM[bucket] = CRM[bucket] || {};
+ _.extend(CRM[bucket], strings);
+ };
+
/**
* @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
*/
angular.extend(templates, module.partials);
}
if (module.strings) {
- angular.extend(CRM.strings, module.strings);
+ CRM.addStrings(module.domain, module.strings);
}
});
notify();
angular.extend(templates, this.data.partials);
}
if (this.data.strings) {
- angular.extend(CRM.strings, this.data.strings);
+ CRM.addStrings(this.data.domain, this.data.strings);
}
angular.forEach(this.deferreds, function(deferred) {
deferred.resolve(module.data);