return dialog.dialog(settings).trigger('crmLoad');
};
+ /** eg CRM.translate('org.example.myext', function(ts){ ... }); */
+ CRM.translate = function(domain, callback) {
+ "use strict";
+ var altTs = function(message, options) {
+ options = options || {};
+ options.domain = domain;
+ return ts(message, options);
+ };
+ callback(altTs);
+ };
+
/**
* @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
*/
--- /dev/null
+module('Translation');
+
+test('ts()', function() {
+ equal(ts('One, two, three'), "Un, deux, trois", "We expect translations to work");
+});
+
+test('CRM.translate()', function() {
+ CRM.translate('org.example.foo', function(ts){
+ equal(ts('One, two, three'), "Un, deux, trois", "We expect translations to work");
+ });
+});
--- /dev/null
+<?php
+CRM_Core_Resources::singleton()->addSetting(array(
+ 'strings' => array('One, two, three' => 'Un, deux, trois')
+ )
+);
+// CRM_Core_Resources::singleton()->addScriptFile(...);
+// CRM_Core_Resources::singleton()->addStyleFile(...);
+// CRM_Core_Resources::singleton()->addSetting(...);