]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Update I18N documentation 25159/head
authorTiago Melo <tmelo@suse.com>
Mon, 19 Nov 2018 16:28:24 +0000 (16:28 +0000)
committerTiago Melo <tmelo@suse.com>
Wed, 21 Nov 2018 15:15:43 +0000 (15:15 +0000)
Add a Suggestions section.

Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/HACKING.rst

index 09c2bd0799d3c39cece8f0357725e8f44cbf107a..1fbebb6e9e3a8d06ae1fb5bba676a685a5671295 100644 (file)
@@ -235,7 +235,7 @@ How to extract messages from source code?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 To extract the I18N messages from the templates and the TypeScript files just
-run the following command in ``src/pybind/mgr/dashboard/frontend``:
+run the following command in ``src/pybind/mgr/dashboard/frontend``::
 
   $ npm run i18n
 
@@ -284,6 +284,72 @@ For example, the path for german would be ``src/locale/messages.de-DE.xlf``.
 ``<locale-id>`` should match the id previouisly inserted in
 ``supported-languages.enum.ts``.
 
+Suggestions
+~~~~~~~~~~~
+
+Strings need to start and end in the same line as the element:
+
+.. code-block:: xml
+
+  <!-- avoid -->
+  <span i18n>
+    Foo
+  </span>
+
+  <!-- recommended -->
+  <span i18n>Foo</span>
+
+
+  <!-- avoid -->
+  <span i18n>
+    Foo bar baz.
+    Foo bar baz.
+  </span>
+
+  <!-- recommended -->
+  <span i18n>Foo bar baz.
+    Foo bar baz.</span>
+
+Isolated interpolations should not be translated:
+
+.. code-block:: xml
+
+  <!-- avoid -->
+  <span i18n>{{ foo }}</span>
+
+  <!-- recommended -->
+  <span>{{ foo }}</span>
+
+Interpolations used in a sentence should be kept in the translation:
+
+.. code-block:: xml
+
+  <!-- recommended -->
+  <span i18n>There are {{ x }} OSDs.</span>
+
+Remove elements that are outside the context of the translation:
+
+.. code-block:: xml
+
+  <!-- avoid -->
+  <label i18n>
+    Profile
+    <span class="required"></span>
+  </label>
+
+  <!-- recommended -->
+  <label>
+    <ng-container i18n>Profile<ng-container>
+    <span class="required"></span>
+  </label>
+
+Keep elements that affect the sentence:
+
+.. code-block:: xml
+
+  <!-- recommended -->
+  <span i18n>Profile <b>foo</b> will be removed.</span>
+
 Backend Development
 -------------------