Setup translations and add French translation.
.gitignore
1 | 1 | dist | |
2 | 2 | *.egg-info | |
3 | + | *.qm | |
3 | 4 | .guix-profile* | |
4 | 5 | _build | |
5 | 6 | build |
Makefile
27 | 27 | ||
28 | 28 | update-data: | |
29 | 29 | python3 extractdata.py | |
30 | + | ||
31 | + | LANGS=fr | |
32 | + | ||
33 | + | update-langs: | |
34 | + | for l in $(LANGS); do \ | |
35 | + | pylupdate5 offlate/*.py -ts i18n/offlate_$${l}.ts ;\ | |
36 | + | lrelease i18n/offlate_$${l}.ts ;\ | |
37 | + | done |
guix-full.manifest
19 | 19 | "python-pyqt" | |
20 | 20 | "python-sphinx" | |
21 | 21 | "python-twine" | |
22 | + | "qt" | |
22 | 23 | "sed" | |
23 | 24 | "tar")) |
i18n/offlate_fr.ts unknown status 1
1 | + | <?xml version="1.0" encoding="utf-8"?> | |
2 | + | <!DOCTYPE TS><TS version="2.0"> | |
3 | + | <context> | |
4 | + | <name>NewWindow</name> | |
5 | + | <message> | |
6 | + | <location filename="../offlate/window.py" line="190"/> | |
7 | + | <source>The Translation Project</source> | |
8 | + | <translation>Le Projet de Traduction</translation> | |
9 | + | </message> | |
10 | + | <message> | |
11 | + | <location filename="../offlate/window.py" line="193"/> | |
12 | + | <source>Cancel</source> | |
13 | + | <translation>Annuler</translation> | |
14 | + | </message> | |
15 | + | <message> | |
16 | + | <location filename="../offlate/window.py" line="194"/> | |
17 | + | <source>OK</source> | |
18 | + | <translation>OK</translation> | |
19 | + | </message> | |
20 | + | </context> | |
21 | + | <context> | |
22 | + | <name>ProjectView</name> | |
23 | + | <message> | |
24 | + | <location filename="../offlate/window.py" line="103"/> | |
25 | + | <source>Singular</source> | |
26 | + | <translation>Singulier</translation> | |
27 | + | </message> | |
28 | + | <message> | |
29 | + | <location filename="../offlate/window.py" line="104"/> | |
30 | + | <source>Plural</source> | |
31 | + | <translation>Pluriel</translation> | |
32 | + | </message> | |
33 | + | </context> | |
34 | + | <context> | |
35 | + | <name>SettingsWindow</name> | |
36 | + | <message> | |
37 | + | <location filename="../offlate/window.py" line="254"/> | |
38 | + | <source>Cancel</source> | |
39 | + | <translation>Annuler</translation> | |
40 | + | </message> | |
41 | + | <message> | |
42 | + | <location filename="../offlate/window.py" line="255"/> | |
43 | + | <source>OK</source> | |
44 | + | <translation>OK</translation> | |
45 | + | </message> | |
46 | + | <message> | |
47 | + | <location filename="../offlate/window.py" line="283"/> | |
48 | + | <source>Email:</source> | |
49 | + | <translation>Adresse de courriel :</translation> | |
50 | + | </message> | |
51 | + | <message> | |
52 | + | <location filename="../offlate/window.py" line="284"/> | |
53 | + | <source>Server:</source> | |
54 | + | <translation>Serveur :</translation> | |
55 | + | </message> | |
56 | + | <message> | |
57 | + | <location filename="../offlate/window.py" line="285"/> | |
58 | + | <source>User Name:</source> | |
59 | + | <translation>Nom d'utilisateur :</translation> | |
60 | + | </message> | |
61 | + | </context> | |
62 | + | <context> | |
63 | + | <name>Window</name> | |
64 | + | <message> | |
65 | + | <location filename="../offlate/window.py" line="356"/> | |
66 | + | <source>Exit application</source> | |
67 | + | <translation>Quitter l'application</translation> | |
68 | + | </message> | |
69 | + | <message> | |
70 | + | <location filename="../offlate/window.py" line="361"/> | |
71 | + | <source>Save current project</source> | |
72 | + | <translation>Sauvegarder le projet actuel</translation> | |
73 | + | </message> | |
74 | + | <message> | |
75 | + | <location filename="../offlate/window.py" line="366"/> | |
76 | + | <source>New project</source> | |
77 | + | <translation>Nouveau projet</translation> | |
78 | + | </message> | |
79 | + | <message> | |
80 | + | <location filename="../offlate/window.py" line="371"/> | |
81 | + | <source>Get modifications from upstream</source> | |
82 | + | <translation>R??cup??rer les modifications en amont</translation> | |
83 | + | </message> | |
84 | + | <message> | |
85 | + | <location filename="../offlate/window.py" line="375"/> | |
86 | + | <source>Close current project</source> | |
87 | + | <translation>Fermer le projet actuel</translation> | |
88 | + | </message> | |
89 | + | <message> | |
90 | + | <location filename="../offlate/window.py" line="380"/> | |
91 | + | <source>Send modifications upstream</source> | |
92 | + | <translation>Envoyer les modifications en amont</translation> | |
93 | + | </message> | |
94 | + | <message> | |
95 | + | <location filename="../offlate/window.py" line="385"/> | |
96 | + | <source>Set parameters</source> | |
97 | + | <translation>Configurer les param??tres</translation> | |
98 | + | </message> | |
99 | + | <message> | |
100 | + | <location filename="../offlate/window.py" line="388"/> | |
101 | + | <source>Show Translated</source> | |
102 | + | <translation>Montrer traduites</translation> | |
103 | + | </message> | |
104 | + | <message> | |
105 | + | <location filename="../offlate/window.py" line="391"/> | |
106 | + | <source>Show Fuzzy</source> | |
107 | + | <translation>Montrer floues</translation> | |
108 | + | </message> | |
109 | + | <message> | |
110 | + | <location filename="../offlate/window.py" line="394"/> | |
111 | + | <source>Show Empty Translation</source> | |
112 | + | <translation>Montrer les traductions vides</translation> | |
113 | + | </message> | |
114 | + | <message> | |
115 | + | <location filename="../offlate/window.py" line="404"/> | |
116 | + | <source>&File</source> | |
117 | + | <translation>&Fichier</translation> | |
118 | + | </message> | |
119 | + | <message> | |
120 | + | <location filename="../offlate/window.py" line="410"/> | |
121 | + | <source>&Project</source> | |
122 | + | <translation>&Projet</translation> | |
123 | + | </message> | |
124 | + | <message> | |
125 | + | <location filename="../offlate/window.py" line="417"/> | |
126 | + | <source>&Edit</source> | |
127 | + | <translation>&??dition</translation> | |
128 | + | </message> | |
129 | + | <message> | |
130 | + | <location filename="../offlate/window.py" line="420"/> | |
131 | + | <source>&View</source> | |
132 | + | <translation>&Affichage</translation> | |
133 | + | </message> | |
134 | + | <message> | |
135 | + | <location filename="../offlate/window.py" line="400"/> | |
136 | + | <source>Open</source> | |
137 | + | <translation>Ouvrir</translation> | |
138 | + | </message> | |
139 | + | <message> | |
140 | + | <location filename="../offlate/window.py" line="354"/> | |
141 | + | <source>Exit</source> | |
142 | + | <translation>Quitter</translation> | |
143 | + | </message> | |
144 | + | <message> | |
145 | + | <location filename="../offlate/window.py" line="359"/> | |
146 | + | <source>Save</source> | |
147 | + | <translation>Sauvegarder</translation> | |
148 | + | </message> | |
149 | + | <message> | |
150 | + | <location filename="../offlate/window.py" line="364"/> | |
151 | + | <source>New</source> | |
152 | + | <translation>Nouveau</translation> | |
153 | + | </message> | |
154 | + | <message> | |
155 | + | <location filename="../offlate/window.py" line="369"/> | |
156 | + | <source>Update</source> | |
157 | + | <translation>Mettre ?? jour</translation> | |
158 | + | </message> | |
159 | + | <message> | |
160 | + | <location filename="../offlate/window.py" line="374"/> | |
161 | + | <source>Close</source> | |
162 | + | <translation>Fermer</translation> | |
163 | + | </message> | |
164 | + | <message> | |
165 | + | <location filename="../offlate/window.py" line="378"/> | |
166 | + | <source>Send</source> | |
167 | + | <translation>Envoyer</translation> | |
168 | + | </message> | |
169 | + | <message> | |
170 | + | <location filename="../offlate/window.py" line="383"/> | |
171 | + | <source>Settings</source> | |
172 | + | <translation>Param??tres</translation> | |
173 | + | </message> | |
174 | + | </context> | |
175 | + | </TS> |
offlate/window.py
51 | 51 | cont = True | |
52 | 52 | if not cont: | |
53 | 53 | continue | |
54 | - | print(entry.flags) | |
55 | - | print(entry.translated()) | |
56 | - | print("") | |
57 | 54 | msgstr = entry.msgstr | |
58 | 55 | if 0 in entry.msgstr_plural: | |
59 | 56 | msgstr = entry.msgstr_plural[0] | |
… | |||
90 | 87 | self.hbox.removeWidget(self.msgstr) | |
91 | 88 | self.msgid.deleteLater() | |
92 | 89 | self.msgstr.deleteLater() | |
93 | - | print(data.msgstr_plural) | |
94 | 90 | if 0 in data.msgstr_plural: | |
95 | 91 | self.msgid = QTabWidget(); | |
96 | 92 | self.msgstr = QTabWidget(); | |
… | |||
100 | 96 | plural = QTextEdit() | |
101 | 97 | plural.setReadOnly(True) | |
102 | 98 | plural.setText(data.msgid_plural) | |
103 | - | self.msgid.addTab(singular, "Singular") | |
104 | - | self.msgid.addTab(plural, "Plural") | |
99 | + | self.msgid.addTab(singular, self.tr("Singular")) | |
100 | + | self.msgid.addTab(plural, self.tr("Plural")) | |
105 | 101 | i = 0 | |
106 | 102 | while i in data.msgstr_plural: | |
107 | 103 | form = QTextEdit() | |
… | |||
140 | 136 | self.project.send(Interface()) | |
141 | 137 | ||
142 | 138 | def askmerge(self, msgid, oldstr, newstr): | |
143 | - | print("Merging {}: {} -> {}".format(msgid, oldstr, newstr)) | |
139 | + | # TODO: Actually do something more intelligent | |
144 | 140 | return newstr | |
145 | 141 | ||
146 | 142 | def update(self): | |
… | |||
185 | 181 | contentbox.addWidget(self.nameWidget) | |
186 | 182 | contentbox.addWidget(self.langWidget) | |
187 | 183 | self.combo = QComboBox() | |
188 | - | self.combo.addItem("The Translation Project") | |
184 | + | self.combo.addItem(self.tr("The Translation Project")) | |
189 | 185 | contentbox.addWidget(self.combo) | |
190 | 186 | hhbox = QHBoxLayout() | |
191 | - | cancel = QPushButton("Cancel") | |
192 | - | ok = QPushButton("OK") | |
187 | + | cancel = QPushButton(self.tr("Cancel")) | |
188 | + | ok = QPushButton(self.tr("OK")) | |
193 | 189 | hhbox.addWidget(cancel) | |
194 | 190 | hhbox.addWidget(ok) | |
195 | 191 | contentbox.addLayout(hhbox) | |
… | |||
249 | 245 | self.addTPTab(tab) | |
250 | 246 | ||
251 | 247 | buttonbox = QHBoxLayout() | |
252 | - | cancel = QPushButton("Cancel") | |
253 | - | ok = QPushButton("OK") | |
248 | + | cancel = QPushButton(self.tr("Cancel")) | |
249 | + | ok = QPushButton(self.tr("OK")) | |
254 | 250 | buttonbox.addWidget(cancel) | |
255 | 251 | buttonbox.addWidget(ok) | |
256 | 252 | ||
… | |||
278 | 274 | self.TPuser.textChanged.connect(self.updateTP) | |
279 | 275 | self.TPserver.textChanged.connect(self.updateTP) | |
280 | 276 | ||
281 | - | formLayout.addRow(QLabel("Email:"), self.TPemail) | |
282 | - | formLayout.addRow(QLabel("Server:"), self.TPserver) | |
283 | - | formLayout.addRow(QLabel("User Name:"), self.TPuser) | |
277 | + | formLayout.addRow(QLabel(self.tr("Email:")), self.TPemail) | |
278 | + | formLayout.addRow(QLabel(self.tr("Server:")), self.TPserver) | |
279 | + | formLayout.addRow(QLabel(self.tr("User Name:")), self.TPuser) | |
284 | 280 | ||
285 | 281 | formBox.setLayout(formLayout) | |
286 | 282 | tab.addTab(formBox, "TP") | |
… | |||
349 | 345 | ||
350 | 346 | def initUI(self): | |
351 | 347 | # Build menu | |
352 | - | exitAct = QAction(QIcon('exit.png'), '&Exit', self) | |
348 | + | exitAct = QAction(QIcon('exit.png'), self.tr('Exit'), self) | |
353 | 349 | exitAct.setShortcut('Ctrl+Q') | |
354 | - | exitAct.setStatusTip('Exit application') | |
350 | + | exitAct.setStatusTip(self.tr('Exit application')) | |
355 | 351 | exitAct.triggered.connect(qApp.quit) | |
356 | 352 | ||
357 | - | saveAct = QAction(QIcon('save.png'), '&Save', self) | |
353 | + | saveAct = QAction(QIcon('save.png'), self.tr('Save'), self) | |
358 | 354 | saveAct.setShortcut('Ctrl+S') | |
359 | - | saveAct.setStatusTip('Save current project') | |
355 | + | saveAct.setStatusTip(self.tr('Save current project')) | |
360 | 356 | saveAct.triggered.connect(self.save) | |
361 | 357 | ||
362 | - | newAct = QAction(QIcon('new.png'), '&New', self) | |
358 | + | newAct = QAction(QIcon('new.png'), self.tr('New'), self) | |
363 | 359 | newAct.setShortcut('Ctrl+N') | |
364 | - | newAct.setStatusTip('New project') | |
360 | + | newAct.setStatusTip(self.tr('New project')) | |
365 | 361 | newAct.triggered.connect(self.new) | |
366 | 362 | ||
367 | - | updateAct = QAction(QIcon('download.png'), '&Update', self) | |
363 | + | updateAct = QAction(QIcon('download.png'), self.tr('Update'), self) | |
368 | 364 | updateAct.setShortcut('Ctrl+U') | |
369 | - | updateAct.setStatusTip('Get modifications from upstream') | |
365 | + | updateAct.setStatusTip(self.tr('Get modifications from upstream')) | |
370 | 366 | updateAct.triggered.connect(self.update) | |
371 | 367 | ||
372 | - | sendAct = QAction(QIcon('close.png'), '&Close', self) | |
373 | - | sendAct.setShortcut('Ctrl+Q') | |
374 | - | sendAct.setStatusTip('Close current project') | |
368 | + | sendAct = QAction(QIcon('close.png'), self.tr('Close'), self) | |
369 | + | sendAct.setStatusTip(self.tr('Close current project')) | |
375 | 370 | sendAct.triggered.connect(self.closeProject) | |
376 | 371 | ||
377 | - | closeAct = QAction(QIcon('upload.png'), '&Send', self) | |
372 | + | closeAct = QAction(QIcon('upload.png'), self.tr('Send'), self) | |
378 | 373 | closeAct.setShortcut('Ctrl+E') | |
379 | - | closeAct.setStatusTip('Send modifications upstream') | |
374 | + | closeAct.setStatusTip(self.tr('Send modifications upstream')) | |
380 | 375 | closeAct.triggered.connect(self.send) | |
381 | 376 | ||
382 | - | settingsAct = QAction(QIcon('settings.png'), '&Settings', self) | |
377 | + | settingsAct = QAction(QIcon('settings.png'), self.tr('Settings'), self) | |
383 | 378 | settingsAct.setShortcut('Ctrl+P') | |
384 | - | settingsAct.setStatusTip('Set parameters') | |
379 | + | settingsAct.setStatusTip(self.tr('Set parameters')) | |
385 | 380 | settingsAct.triggered.connect(self.settings) | |
386 | 381 | ||
387 | - | self.showTranslatedAct = QAction('Show Translated', self, checkable=True) | |
382 | + | self.showTranslatedAct = QAction(self.tr('Show Translated'), self, checkable=True) | |
388 | 383 | self.showTranslatedAct.setChecked(True) | |
389 | 384 | self.showTranslatedAct.triggered.connect(self.filter) | |
390 | - | self.showFuzzyAct = QAction('Show Fuzzy', self, checkable=True) | |
385 | + | self.showFuzzyAct = QAction(self.tr('Show Fuzzy'), self, checkable=True) | |
391 | 386 | self.showFuzzyAct.setChecked(True) | |
392 | 387 | self.showFuzzyAct.triggered.connect(self.filter) | |
393 | - | self.showUntranslatedAct = QAction('Show Empty Translation', self, checkable=True) | |
388 | + | self.showUntranslatedAct = QAction(self.tr('Show Empty Translation'), self, checkable=True) | |
394 | 389 | self.showUntranslatedAct.setChecked(True) | |
395 | 390 | self.showUntranslatedAct.triggered.connect(self.filter) | |
396 | 391 | ||
397 | 392 | self.statusBar() | |
398 | 393 | ||
399 | - | openMenu = QMenu('Open', self) | |
394 | + | openMenu = QMenu(self.tr('Open'), self) | |
400 | 395 | self.initOpenProjects(openMenu) | |
401 | 396 | ||
402 | 397 | menubar = self.menuBar() | |
403 | - | fileMenu = menubar.addMenu('&File') | |
398 | + | fileMenu = menubar.addMenu(self.tr('&File')) | |
404 | 399 | fileMenu.addAction(newAct) | |
405 | 400 | fileMenu.addMenu(openMenu) | |
406 | 401 | fileMenu.addSeparator() | |
407 | 402 | fileMenu.addAction(exitAct) | |
408 | 403 | ||
409 | - | projectMenu = menubar.addMenu('&Project') | |
404 | + | projectMenu = menubar.addMenu(self.tr('&Project')) | |
410 | 405 | projectMenu.addAction(updateAct) | |
411 | 406 | projectMenu.addAction(saveAct) | |
412 | 407 | projectMenu.addAction(sendAct) | |
413 | 408 | projectMenu.addSeparator() | |
414 | 409 | projectMenu.addAction(closeAct) | |
415 | 410 | ||
416 | - | editMenu = menubar.addMenu('&Edit') | |
411 | + | editMenu = menubar.addMenu(self.tr('&Edit')) | |
417 | 412 | editMenu.addAction(settingsAct) | |
418 | 413 | ||
419 | - | viewMenu = menubar.addMenu('&View') | |
414 | + | viewMenu = menubar.addMenu(self.tr('&View')) | |
420 | 415 | viewMenu.addAction(self.showTranslatedAct) | |
421 | 416 | viewMenu.addAction(self.showUntranslatedAct) | |
422 | 417 | viewMenu.addAction(self.showFuzzyAct) | |
… | |||
431 | 426 | ||
432 | 427 | def main(): | |
433 | 428 | app = QApplication(sys.argv) | |
429 | + | translator = QTranslator() | |
430 | + | if translator.load(QLocale(), "offlate", "_", "i18n"): | |
431 | + | app.installTranslator(translator); | |
434 | 432 | ||
435 | 433 | w = Window() | |
436 | 434 |