audour opened a new issue #16550:
URL: https://github.com/apache/superset/issues/16550


   ### Expected results
   
   Superset is usable in French
   
   ### Actual results
   
   French translation is not usable (too many mistakes/missing translations)
   
   #### Screenshots
   
   For instance within 
`superset/superset/translations/fr/LC_MESSAGES/messages.json`
   
   * `"Annotation delete failed.": ["Annotations et couches"]` -> it means 
"Annoations and layers"
   * `"Annotation layer parameters are invalid.": ["Les couches d'annotation 
sont toujours en cours de chargement."]` -> it means "Annotation layers are 
still loading"
   * `"Annotation layer could not be deleted.": ["Les couches d'annotation sont 
toujours en cours de chargement."]` -> it means "Annotation layers are still 
loading"
   
   ### Environment
   
   - superset version: `1.3.0`
   
   ### Checklist
   
   - [ x ] I have reproduced the issue with at least the latest released 
version of superset.
   - [ x ] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Contribution proposal (but need some help)
   
   Hi,
   
   I've created this issue as I plan to improve whole french translation ASAP 
which is not really usable for now (too many missing translations).
   I've read 
[CONTRIBUTING.md#translating](https://github.com/apache/superset/blob/master/CONTRIBUTING.md#translating)
 but not everything is clear to me and I've faced some trouble with `pybabel 
extract`. That's why I'm looking for a confirmation/help about the good process.
   
   I plan to do the following :
   
   * fork superset repo [done]
   * create a branch `fr_translation_improvement` [done]
   * install Babel with virtualenv [done]
   * extract new strings for translation (`pybabel extract...` produces `.pot`) 
-> I got an error here (see below), but is this step really needed here ?
   * update language files (`pybabel update...` produces `.po` for each 
language) -> it works
   * keep only `.po` updates related to the language I want to translate : 
`superset/translations/fr/LC_MESSAGES/messages.po`, and discard others
   
   From here I'm a little bit lost. From what I've read and by checking some PR 
like [chore: Add Slovenian (sl_SI) translation 
#14908](https://github.com/apache/superset/pull/14908), it seems that the main 
goal is to update `messages.po` and `messages.json` files under 
`superset/translations/fr/LC_MESSAGES` (and then submit a PR), but the process 
is not clear to me:
   
   * option 1 : translate the `.po` file, then convert the PO file into a JSON 
file using `po2json` and then commit the `.po` and the `.json` files together ?
   * option 2 : convert the PO file into a JSON file using `po2json`, then 
translate the `.json`, then use `pybabel compile` to update the `.po` from the 
`.json` ?
   * any other option ?
   
   However when I run `pybabel extract -F superset/translations/babel.cfg -o 
superset/translations/messages.pot -k _ -k __ -k t -k tn -k tct .` I get this 
error: 
   
   ```
   extracting messages from superset/__init__.py
   extracting messages from superset/app.py
   extracting messages from superset/cli.py
   extracting messages from superset/config.py
   extracting messages from superset/constants.py
   extracting messages from superset/dataframe.py
   extracting messages from superset/errors.py
   extracting messages from superset/exceptions.py
   extracting messages from superset/extensions.py
   extracting messages from superset/forms.py
   extracting messages from superset/jinja_context.py
   extracting messages from superset/legacy.py
   extracting messages from superset/result_set.py
   extracting messages from superset/schemas.py
   extracting messages from superset/sql_lab.py
   Traceback (most recent call last):
     File "/path_to_venv/venv/bin/pybabel", line 8, in <module>
       sys.exit(main())
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/frontend.py", 
line 929, in main
       return CommandLineInterface().run(sys.argv)
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/frontend.py", 
line 853, in run
       return cmdinst.run()
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/frontend.py", 
line 481, in run
       for filename, lineno, message, comments, context in extracted:
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/extract.py", 
line 149, in extract_from_dir
       for message_tuple in check_and_call_extract_file(
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/extract.py", 
line 207, in check_and_call_extract_file
       for message_tuple in extract_from_file(
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/extract.py", 
line 243, in extract_from_file
       return list(extract(method, fileobj, keywords, comment_tags,
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/extract.py", 
line 325, in extract
       for lineno, funcname, messages, comments in results:
     File 
"/path_to_venv/venv/lib/python3.8/site-packages/babel/messages/extract.py", 
line 487, in extract_python
       value = eval(code, {'__builtins__': {}}, {})
     File "<string>", line 2, in <module>
   NameError: name 'SQLLAB_TIMEOUT' is not defined
   ```
   
   To finish, I've a last concern: what has motivated this translation is that 
I need a French translation for an existing superset `1.2.0` instance. I need 
the translation ASAP without waiting for a superset upgrade.
   Will I be able to use the translated files based on superset current 
`master` branch within the `1.2.0` version ? Even partially for the strings 
which have not changed since `1.2.0`.
   
   Thanks in advance for your answer.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to