Changes for page Weblate Configuration

Last modified by Simon Urli on 2021/09/17 10:28

<
From version < 5.1 >
edited by Adel Atallah
on 2018/05/09 09:29
To version < 6.1 >
edited by Adel Atallah
on 2018/05/15 10:39
>
Change comment: Explain how to import new translation files

Summary

Details

Page properties
Content
... ... @@ -122,7 +122,7 @@
122 122  
123 123  Make sure you have sourced the virtualenv activate script ({{box}}source $VIRTUALENV/bin/activate{{/box}}) and run {{box}}weblate runserver{{/box}}.
124 124  
125 -= How to import translation files =
125 += How to import translation files manually =
126 126  
127 127  Login with an admin account to your weblate instance. You can generate one by running {{box}}weblate createadmin{{/box}}.
128 128  
... ... @@ -174,21 +174,33 @@
174 174  * Pre-commit script: **pre_commit.sh**
175 175  * Post-commit script: **post_commit.sh**
176 176  
177 -There are many components to be created, that's why the (% class="mark" %)generate_components.py(%%) script has been written to generate a json file with all the components to be created, based on a list of translation file.
177 += How to import translation files automatically =
178 178  
179 -The list of translation file looks like this:
179 +There are many components to be created, that's why the (% class="mark" %)generate_components.py(%%) script has been written to generate a json file with all the components to be created, based on some lists of translation files.
180 +The script can be found in the [[xwiki-dev-tools project>>https://github.com/xwiki/xwiki-dev-tools]]: {{box}}xwiki-dev-tools/weblate-scripts/generate_components.py{{/box}}
181 +A list of translation file has a name like this one `translation_list_xwiki-commons.txt`, where `xwiki-commons` is the name of the project, and looks like this:
180 180  
181 181  (% class="box" %)
182 182  (((
183 -##Help.SupportPanel.Content xwiki-platform-core/xwiki-platform-help/xwiki-platform-help-ui/src/main/resources/Help/SupportPanel/Content.xml
184 -XWiki.XWikiSyntaxGeneralRemarks xwiki-platform-core/xwiki-platform-help/xwiki-platform-help-ui/src/main/resources/XWiki/XWikiSyntaxGeneralRemarks.xml
185 -TemplateMacro xwiki-platform-core/xwiki-platform-template/xwiki-platform-template-api/src/main/resources/ApplicationResources.properties
186 -Localization Macro xwiki-platform-core/xwiki-platform-localization/xwiki-platform-localization-macro/src/main/resources/ApplicationResources.properties
187 -...##
185 +#Format: Name of the component; Relative path to the translation file; Repository url
186 + xwiki-commons-extension-api; xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/resources/ApplicationResources.properties; https:~/~/github.com/xwiki/xwiki-commons
187 + xwiki-commons-job; xwiki-commons-core/xwiki-commons-job/src/main/resources/ApplicationResources.properties; https:~/~/github.com/xwiki/xwiki-commons
188 188  )))
189 189  
190 -Running the script will generate the ##components.json## file. It can be imported by running {{box}}weblate import_json components.json ~-~-project xwiki-platform ~-~-main-component help-supportpanel-content{{/box}}.
190 +Running the script will generate the ##components_xwiki-commons.json## file. It can be imported by running {{box}}weblate import_json components_xwiki-commons.json ~-~-project xwiki-commons{{/box}}.
191 191  
192 +== Importing new translation files ==
193 +
194 +If you just want to add new translation files to an existing project, you'll have to change two files and run two commands.
195 +Let's say you want to add a ##.properties## translation file from the ##xwiki-platform## project. In the [[xwiki-dev-tools project>>https://github.com/xwiki/xwiki-dev-tools]], you'll have to change the files ##xwiki-dev-tools/weblate-scripts/translation_list_xwiki-platform.txt## and ##xwiki-dev-tools/weblate-scripts/translation_properties.txt##.
196 +
197 +1. Add at the end of ##translation_list_xwiki-platform.txt## a line with the following format: {{box}}Name of the component; Relative path to the translation file; Repository url{{/box}}
198 +For instance: {{box}}Help.SupportPanel.Content; xwiki-platform-core/xwiki-platform-help/xwiki-platform-help-ui/src/main/resources/Help/SupportPanel/Content.xml; https://github.com/xwiki/xwiki-platform{{/box}}
199 +1. Add at the end of ##translation_properties.txt## a line with the relative path to the translation files.
200 +For instance: {{box}}xwiki-platform-core/xwiki-platform-template/xwiki-platform-template-api/src/main/resources/ApplicationResources.properties{{/box}}
201 +1. Run the {{box}}generate_components.py{{/box}} script to generate ##components_xwiki-platform.json##
202 +1. Run the command {{box}}weblate import_json components_xwiki-platform.json ~-~-project xwiki-platform ~-~-ignore{{/box}} to finally import the new components (translation files).
203 +
192 192  = How to upgrade Weblate =
193 193  
194 194  The whole process can be found [[here>>https://docs.weblate.org/en/latest/admin/upgrade.html]].

Get Connected