diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-12 21:38:03 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-12 22:10:16 +0400 |
commit | a5ab907fe3d09ad1aacd1a0718566aad9768889b (patch) | |
tree | 6bd50b5c3583b912671f2220f96d96666115ddd3 /plugins/ExamplePlugin | |
parent | 9cd4cd3dd0a68e43fc9e6b9a9826c9a09fde5114 (diff) |
Refs #4151, remove loadJavascriptTranslations twig function and automatically generate translation JS for all plugins. Translation JS is now treated as an asset and is included in merged JS.
Note:
- Includes tweaks to capture.js: on webpage error stop capture program.
Diffstat (limited to 'plugins/ExamplePlugin')
-rw-r--r-- | plugins/ExamplePlugin/Controller.php | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/plugins/ExamplePlugin/Controller.php b/plugins/ExamplePlugin/Controller.php index 866428bd8a..8b1c0625ca 100644 --- a/plugins/ExamplePlugin/Controller.php +++ b/plugins/ExamplePlugin/Controller.php @@ -124,9 +124,7 @@ class Controller extends \Piwik\Controller $out .= 'In order to translate strings within Javascript code, you can use the javascript function _pk_translate( token );. <ul><li>The "token" parameter is the string unique key found in the translation file. For this token string to be available in Javascript, you must suffix your token by "_js" in the language file. For example, you can add <code>\'Goals_AddGoal_js\' => \'Add Goal\',</code> in the lang/en.php file</li> - <li>You then need to instruct Piwik to load your Javascript translations for your plugin; by default, all translation strings are not loaded in Javascript for performance reasons. This can be done by calling a custom-made Twig modifier before the Javascript code requiring translations, eg. - <code>{loadJavascriptTranslations plugins=\'$YOUR_PLUGIN_NAME\'}</code>. In our previous example, the $YOUR_PLUGIN_NAME being Goals, we would write <code>{loadJavascriptTranslations plugins=\'Goals\'}</code> - </li><li>You can then print this string from your JS code by doing <code>_pk_translate(\'Goals_AddGoal_js\');</code>. + <li>You can then print this string from your JS code by doing <code>_pk_translate(\'Goals_AddGoal_js\');</code>. </li></ul>'; $out .= '<h3>Reload a widget in the dashboard</h3>'; |