You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/19 17:04:49 UTC

[GitHub] [superset] ktmud commented on a change in pull request #12595: fix: translation files and update documentation

ktmud commented on a change in pull request #12595:
URL: https://github.com/apache/superset/pull/12595#discussion_r560327566



##########
File path: superset/translations/po2json.sh
##########
@@ -0,0 +1,11 @@
+def=superset/translations/messages.pot
+for file in $( find ./superset/translations/** );
+do
+  extension=${file##*.}
+  filename="${file%.*}"
+  if [ $extension == "po" ]
+  then
+    po2json --domain superset --format jed1.x $file $filename.json
+    ./superset-frontend/node_modules/.bin/prettier --write $filename.json
+  fi
+done

Review comment:
       nit: missing EOF

##########
File path: CONTRIBUTING.md
##########
@@ -755,22 +756,34 @@ LANGUAGES = {
 ### Extracting new strings for translation
 
 ```bash
-flask fab babel-extract --target superset/translations --output superset/translations/messages.pot --config superset/translations/babel.cfg -k _ -k __ -k t -k tn -k tct
+pybabel extract -F superset/translations/babel.cfg -o superset/translations/messages.pot -k _ -k __ -k t -k tn -k tct .
+```
+
+This will update the template file `superset/translations/messages.pot` with current application strings.
+
+### Updating language files
+
+```bash
+ pybabel update -i superset/translations/messages.pot -d superset/translations --ignore-obsolete
 ```
 
+This will update language files with the new extracted strings.
+
 You can then translate the strings gathered in files located under
 `superset/translation`, where there's one per language. You can use [Poedit](https://poedit.net/features)
 to translate the `po` file more conveniently.
 There are some [tutorials in the wiki](https://wiki.lxde.org/en/Translate_*.po_files_with_Poedit).
 
-For the translations to take effect:
+In the case of JS translation, we need to convert the PO file into a JSON file, and we need the global download of the npm package po2json.
 
 ```bash
-# In the case of JS translation, we need to convert the PO file into a JSON file, and we need the global download of the npm package po2json.
 npm install -g po2json
-flask fab babel-compile --target superset/translations
-# Convert the en PO file into a JSON file
-po2json -d superset -f jed1.x superset/translations/en/LC_MESSAGES/messages.po superset/translations/en/LC_MESSAGES/messages.json
+```
+
+To convert all PO files to formatted JSON files you can use the `po2json.sh` script.
+
+```bash
+./superset/translations/po2json.sh

Review comment:
       Should we move this script to `./scripts/`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org