Skip to content

Commit 4cd3a81

Browse files
committed
help translation
1 parent 71b74c5 commit 4cd3a81

1 file changed

Lines changed: 173 additions & 0 deletions

File tree

docs/doc/fr/Translation.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,176 @@ Glossaire concernant la traduction, afin d’avoir une cohérence dans la traduc
1919
- Green blind : Deutéranopie
2020
- Pie charts : Diagrammes circulaires
2121
- Bar charts : Graphique à barres
22+
23+
24+
25+
26+
27+
28+
29+
---------------
30+
31+
Notes for creating language files
32+
33+
34+
35+
=================================
36+
37+
38+
List_of_ISO_639-1_codes
39+
40+
41+
2 letter codes for different languages
42+
43+
44+
45+
46+
47+
For Qt translations files: .ts to .qm
48+
49+
50+
=====================================
51+
52+
53+
Installs:
54+
55+
56+
sudo apt install python-setuptools
57+
58+
59+
sudo apt install qttools5-dev-tools # for project.pro to convert multiple files at once
60+
61+
62+
sudo apt install qtcreator
63+
64+
65+
sudo apt -y install linguist-qt6
66+
67+
68+
sudo apt install pyqt6-dev-tools
69+
70+
71+
72+
73+
74+
In directory qualcoder/GUI
75+
76+
77+
Need a .pro file in the qualcoder/GUI directory
78+
79+
80+
run:
81+
82+
83+
pylupdate5 project.pro -noobsolete
84+
85+
86+
87+
88+
89+
Note pylupdate6 does not work well, it replaces with blank entries, instead of drawing from existing ts files.
90+
91+
92+
93+
94+
95+
This helper file for this: rebuild_lang.py will updat all the placeholders fo rthe languages in both po and ts files. Run from the Qualcder-master efolder.
96+
97+
98+
99+
100+
101+
ts files are released as app_name.qm
102+
103+
104+
Release is placed in qualcoder/locale/name/name.qm
105+
106+
107+
108+
109+
110+
#####################################
111+
112+
113+
114+
115+
116+
Strings in python code need to be translated.
117+
118+
119+
https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules
120+
121+
122+
123+
124+
125+
Code in the main module:
126+
127+
128+
install gettext
129+
130+
131+
At the start:
132+
133+
134+
lang = gettext.translation('qualcoder', localedir='/GUI/', languages=['fr'])
135+
136+
137+
lang.install()
138+
139+
140+
141+
142+
143+
144+
145+
146+
# Install poedit
147+
148+
149+
sudo apt install poedit
150+
151+
152+
153+
154+
155+
In terminal, run these scripts from the qualcoder folder to prepare the po files:
156+
157+
158+
Note this is replaced with the above helper file.
159+
160+
161+
162+
163+
164+
-d is default output name e.g. fr
165+
166+
167+
-j option to join existing file
168+
169+
170+
# note dont use -j lang.po on first creating a po file
171+
172+
173+
174+
175+
176+
For individual update to po files see below example for Deutsch:
177+
178+
179+
180+
181+
182+
xgettext -d de -j de.po __main__.py add_attribute.py add_item_name.py ai_chat.py ai_llm.py ai_prompts.py ai_search_dialog.py ai_vectorstore.py attributes.py case_file_manager.py cases.py code_color_scheme.py code_text.py code_in_all_files.py code_organiser.py code_pdf.py codebook.py color_selector.py confirm_delete.py edit_textfile.py helpers.py import_survey.py import_twitter_data.py information.py journals.py manage_files.py manage_links.py manage_references.py memo.py merge_projects.py move_resize_rectangle.py pseudonyms.py refi.py report_attributes.py report_codes.py report_code_summary.py report_codes_by_segments.py report_compare_coder_file.py report_cooccurrence.py report_exact_matches.py report_file_summary.py report_relations.py reports.py report_sql.py rqda.py save_sql_query.py select_items.py settings.py special_functions.py text_mining.py view_av.py view_charts.py view_graph.py view_image.py
183+
184+
185+
186+
187+
188+
After translating, save will produce a name.po and a name.mo file
189+
190+
191+
192+
193+
194+
The .mo file is placed in qualcoder/locale/name/LC_MESSAGES/name.mo

0 commit comments

Comments
 (0)