skybber / fchart3

Python scripts to make beautiful deepsky finder charts and maps in various image formats.
GNU General Public License v2.0
12 stars 5 forks source link

Gaorion patch 1 #9

Closed Gaorion closed 10 months ago

skybber commented 10 months ago

Is there any problem to use i18n stuff in fchart3 bin, it seems that it will be hard to synchronize code in both files in the future.

Gaorion commented 10 months ago

maybe i misunderstood but fchart3i18n.py will be fchart3 ( in github preferred not replace it ) Babel dont scan fchart3 because it dont have the extension .py

so 1 rename fchart3 in fchart3.py 2 scan with babel pybabel extract . -o locale/base.pot pybabel update -i locale/base.pot -d locale pybabel compile -d locale 3 remove the extension .py 4 install

This afternoon i finished to scan all the code for replacement of print() by print (( )) and i find this solution 4 the widget LABELi18N = { 'h': ('h'), 'm':('m'), 's':('s'), 'G':('Galaxy'), 'OCL':('Open cluster'), 'GCL':('Globular cluster'), 'AST':('Asterism'), 'PN':('Planetary nebula'), 'N': ('Diffuse nebula'), 'SNR':('Supernova remnant'), 'PG':('Part of galaxy') }

skybber commented 10 months ago

So I've renamed fchart3i18n.py to fchart3+fixed problems (missing brackets)

Gaorion commented 10 months ago

okay !

I finished the work but i use a environment variable to set the language it's more simple to pass var into modules a nother option could be .env (Python-dotenv) but you already have "Configuration system"

skybber commented 10 months ago

If I understand you correctly, there could be priority of sources from which the actual language ID is loaded. For example from lowest to highest:

  1. system lang
  2. .env
  3. enviroment variable
  4. configuration file
Gaorion commented 10 months ago