Skip to content

Commit 1dd1334

Browse files
authored
Create createlang.md
1 parent cec341c commit 1dd1334

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

‎docs/wikidev/createlang.md‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---------------
2+
Notes for creating language files
3+
4+
=================================
5+
6+
List_of_ISO_639-1_codes
7+
8+
2 letter codes for different languages
9+
10+
For Qt translations files: .ts to .qm
11+
12+
=====================================
13+
Installs
14+
sudo apt install python-setuptools
15+
sudo apt install qttools5-dev-tools # for project.pro to convert multiple files at once
16+
sudo apt install qtcreator
17+
sudo apt -y install linguist-qt6
18+
sudo apt install pyqt6-dev-tools
19+
20+
In directory qualcoder/GUI
21+
Need a .pro file in the qualcoder/GUI directory
22+
23+
run:
24+
pylupdate5 project.pro -noobsolete
25+
Note pylupdate6 does not work well, it replaces with blank entries, instead of drawing from existing ts files.
26+
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.
27+
28+
ts files are released as app_name.qm
29+
Release is placed in qualcoder/locale/name/name.qm
30+
31+
#####################################
32+
33+
Strings in python code need to be translated.
34+
https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules
35+
Code in the main module:
36+
install gettext
37+
At the start:
38+
lang = gettext.translation('qualcoder', localedir='/GUI/', languages=['fr'])
39+
lang.install()
40+
# Install poedit
41+
sudo apt install poedit
42+
In terminal, run these scripts from the qualcoder folder to prepare the po files:
43+
Note this is replaced with the above helper file.
44+
-d is default output name e.g. fr
45+
-j option to join existing file
46+
# note dont use -j lang.po on first creating a po file
47+
48+
For individual update to po files see below example for Deutsch:
49+
50+
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
51+
52+
After translating, save will produce a name.po and a name.mo file
53+
```
54+
55+
56+
57+
The .mo file is placed in qualcoder/locale/name/LC_MESSAGES/name.m

0 commit comments

Comments
 (0)