@@ -6,7 +6,7 @@ A Symfony 4 bundle that provides some common parts of web-based tools in Wikimed
66Features:
77
88* OAuth user authentication against [ Meta Wiki] ( https://meta.wikimedia.org/ ) .
9- * Internationalization with the Intuition and jQuery.i18n libraries.
9+ * Internationalization with the [ Intuition] ( https://intuition.toolforge.org/ ) and jQuery.i18n libraries.
1010* Interface to connect and query the [ replica databases] ( https://wikitech.wikimedia.org/wiki/Wiki_replicas )
1111* PHP Code Sniffer ruleset
1212* Base Wikimedia UI stylesheet (LESS)
@@ -93,10 +93,10 @@ to the full URL to `Special:OAuth`.
9393Add a login link to the relevant Twig template (often ` base.html.twig ` ), e.g.:
9494
9595 {% if logged_in_user() %}
96- {{ msg( 'logged-in-as', [ logged_in_user().username ] ) }}
97- <a href="{{ path('toolforge_logout') }}">{{ msg('logout') }}</a>
96+ {{ msg( 'toolforge- logged-in-as', [ logged_in_user().username ] ) }}
97+ <a href="{{ path('toolforge_logout') }}">{{ msg('toolforge- logout') }}</a>
9898 {% else %}
99- <a href="{{ path('toolforge_login') }}">{{ msg('login') }}</a>
99+ <a href="{{ path('toolforge_login') }}">{{ msg('toolforge- login') }}</a>
100100 {% endif %}
101101
102102The internationalization parts of this are explained below.
@@ -140,6 +140,11 @@ ultimately be redirected back to `https://my-tool.toolforge.org/my-page?foo=bar`
140140
141141### Internationalization (Intuition and jQuery.i18n)
142142
143+ Internationalization is handled similarly to how it is done in MediaWiki,
144+ with translated strings being stored in ` i18n/ ` directories.
145+ The bundle comes with some strings of its own, all prefixed with ` toolforge_ ` ;
146+ it is recommended that these are used where possible because it reduces the work for translators.
147+
143148#### 1. PHP
144149
145150In PHP, set your application's i18n 'domain' with the following in ` config/packages/toolforge.yaml ` :
@@ -148,9 +153,9 @@ In PHP, set your application's i18n 'domain' with the following in `config/packa
148153 intuition:
149154 domain: 'app-name-here'
150155
151- You can inject Intuition into your controllers via type hinting, e.g.:
156+ You can inject (the bundle's subclass of) Intuition into your controllers via type hinting, e.g.:
152157
153- public function indexAction( Request $request, Intuition $intuition ) { /*...*/ }
158+ public function indexAction( Request $request, \Wikimedia\ToolforgeBundle\Service\ Intuition $intuition ) { /*...*/ }
154159
155160The following Twig functions and filters are available:
156161
@@ -182,7 +187,7 @@ In Javascript, you need to do three things to enable internationalisation:
182187 <script type="text/javascript" src="https://tools-static.wmflabs.org/cdnjs/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
183188 {% include '@toolforge/i18n.html.twig' %}
184189
185- (The jQuery can of course be left out if you're already loading that through other means.)
190+ (The jQuery can be left out if you're already loading that through other means.)
186191
1871923 . And symlink your ` i18n/ ` directory from ` public/i18n/ ` ,
188193 so that the language files can be loaded by from Javascript.
0 commit comments