Skip to content

Commit baf4b57

Browse files
authored
Create 7.6.-How-to-contribute.md
1 parent cae8171 commit baf4b57

1 file changed

Lines changed: 186 additions & 0 deletions

File tree

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
---
2+
path: en/7.6.-How-to-contribute.md
3+
---
4+
5+
# How to contribute
6+
7+
## Contributing to the code
8+
9+
Please read the [contribution guidelines](https://github.com/ccbogel/QualCoder?tab=contributing-ov-file)
10+
11+
## Contribute to the translation
12+
### Translate the documentation
13+
14+
You can translate the documentation by creating/modifying the markdown files in docs/doc in [the website repository](https://github.com/QualCoder-Org/qualcoder-org.github.io).
15+
16+
### Translate the software
17+
18+
There are several translation files, which can be opened with [Poedit](https://poedit.net/). The .qm files are located in src/qualcoder/GUI. The .po files are located in src/qualcoder. You can update the language file by running ```python rebuild_lang.py --update``` and compile by running ```python rebuild_lang.py --compile```
19+
20+
```
21+
---------------
22+
23+
Notes for creating language files
24+
25+
26+
=================================
27+
28+
29+
List_of_ISO_639-1_codes
30+
31+
32+
2 letter codes for different languages
33+
34+
35+
36+
37+
38+
For Qt translations files: .ts to .qm
39+
40+
41+
=====================================
42+
43+
44+
Installs:
45+
46+
47+
sudo apt install python-setuptools
48+
49+
50+
sudo apt install qttools5-dev-tools # for project.pro to convert multiple files at once
51+
52+
53+
sudo apt install qtcreator
54+
55+
56+
sudo apt -y install linguist-qt6
57+
58+
59+
sudo apt install pyqt6-dev-tools
60+
61+
62+
63+
64+
65+
In directory qualcoder/GUI
66+
67+
68+
Need a .pro file in the qualcoder/GUI directory
69+
70+
71+
run:
72+
73+
74+
pylupdate5 project.pro -noobsolete
75+
76+
77+
78+
79+
80+
Note pylupdate6 does not work well, it replaces with blank entries, instead of drawing from existing ts files.
81+
82+
83+
84+
85+
86+
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.
87+
88+
89+
90+
91+
92+
ts files are released as app_name.qm
93+
94+
95+
Release is placed in qualcoder/locale/name/name.qm
96+
97+
98+
99+
100+
101+
#####################################
102+
103+
104+
105+
106+
107+
Strings in python code need to be translated.
108+
109+
110+
https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules
111+
112+
113+
114+
115+
116+
Code in the main module:
117+
118+
119+
install gettext
120+
121+
122+
At the start:
123+
124+
125+
lang = gettext.translation('qualcoder', localedir='/GUI/', languages=['fr'])
126+
127+
128+
lang.install()
129+
130+
131+
132+
133+
134+
135+
136+
137+
# Install poedit
138+
139+
140+
sudo apt install poedit
141+
142+
143+
144+
145+
146+
In terminal, run these scripts from the qualcoder folder to prepare the po files:
147+
148+
149+
Note this is replaced with the above helper file.
150+
151+
152+
153+
154+
155+
-d is default output name e.g. fr
156+
157+
158+
-j option to join existing file
159+
160+
161+
# note dont use -j lang.po on first creating a po file
162+
163+
164+
165+
166+
167+
For individual update to po files see below example for Deutsch:
168+
169+
170+
171+
172+
173+
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
174+
175+
176+
177+
178+
179+
After translating, save will produce a name.po and a name.mo file
180+
181+
182+
183+
184+
185+
The .mo file is placed in qualcoder/locale/name/LC_MESSAGES/name.mo
186+
```

0 commit comments

Comments
 (0)