@@ -30,42 +30,68 @@ localization there.
3030
3131Extraction
3232----------
33- There should be minimal cases where strings need to be extracted from source code; however it may be necessary in some
34- situations. For example if a system tray icon is added it should be localized as it is user interfacing.
3533
36- - Wrap the string to be extracted in a function as shown.
37- .. code-block :: cpp
34+ .. tab :: UI
3835
39- #include <boost/locale.hpp>
40- #include <string>
36+ Sunshine uses ` Vue I18n < https://vue-i18n.intlify.dev/ >`__ for localizing the UI.
37+ The following is a simple example of how to use it.
4138
42- std::string msg = boost::locale::translate("Hello world!");
39+ - Add the string to `src_assets/common/assets/web/locale/sunshine.json ` in English.
40+ .. code-block :: json
4341
44- .. tip :: More examples can be found in the documentation for
45- `boost locale <https://www.boost.org/doc/libs/1_70_0/libs/locale/doc/html/messages_formatting.html >`__.
42+ {
43+ "index" : {
44+ "welcome" : " Hello, Sunshine!"
45+ }
46+ }
4647
47- .. warning :: This is for information only. Contributors should never include manually updated template files, or
48- manually compiled language files in Pull Requests.
48+ - Use the string in a Vue component.
49+ .. code-block :: html
4950
50- Strings are automatically extracted from the code to the `locale/sunshine.po ` template file. The generated file is
51- used by CrowdIn to generate language specific template files. The file is generated using the
52- `.github/workflows/localize.yml ` workflow and is run on any push event into the `nightly ` branch. Jobs are only run if
53- any of the following paths are modified.
51+ <template >
52+ <div >
53+ <p >{{ $t('index.welcome') }}</p >
54+ </div >
55+ </template >
5456
55- .. code-block :: yaml
57+ .. tab :: C++
5658
57- - ' src/**'
59+ There should be minimal cases where strings need to be extracted from C++ source code; however it may be necessary in
60+ some situations. For example the system tray icon could be localized as it is user interfacing.
5861
59- When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is
60- required for this, along with the python dependencies in the `./scripts/requirements.txt ` file. Additionally,
61- `xgettext <https://www.gnu.org/software/gettext/ >`__ must be installed.
62+ - Wrap the string to be extracted in a function as shown.
63+ .. code-block :: cpp
6264
63- ** Extract, initialize, and update **
64- .. code-block :: bash
65+ #include <boost/locale.hpp>
66+ #include <string>
6567
66- python ./scripts/_locale.py --extract --init --update
68+ std::string msg = boost::locale::translate("Hello world!");
6769
68- ** Compile **
69- .. code-block :: bash
70+ .. tip :: More examples can be found in the documentation for
71+ ` boost locale < https://www.boost.org/doc/libs/1_70_0/libs/locale/doc/html/messages_formatting.html >`__.
7072
71- python ./scripts/_locale.py --compile
73+ .. warning :: This is for information only. Contributors should never include manually updated template files, or
74+ manually compiled language files in Pull Requests.
75+
76+ Strings are automatically extracted from the code to the `locale/sunshine.po ` template file. The generated file is
77+ used by CrowdIn to generate language specific template files. The file is generated using the
78+ `.github/workflows/localize.yml ` workflow and is run on any push event into the `nightly ` branch. Jobs are only run if
79+ any of the following paths are modified.
80+
81+ .. code-block :: yaml
82+
83+ - ' src/**'
84+
85+ When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is
86+ required for this, along with the python dependencies in the `./scripts/requirements.txt ` file. Additionally,
87+ `xgettext <https://www.gnu.org/software/gettext/ >`__ must be installed.
88+
89+ **Extract, initialize, and update **
90+ .. code-block :: bash
91+
92+ python ./scripts/_locale.py --extract --init --update
93+
94+ **Compile **
95+ .. code-block :: bash
96+
97+ python ./scripts/_locale.py --compile
0 commit comments