Report statistics in status bar
i18n/offlate_fr.ts
3 | 3 | <context> | |
4 | 4 | <name>NewWindow</name> | |
5 | 5 | <message> | |
6 | - | <location filename="../offlate/window.py" line="204"/> | |
6 | + | <location filename="../offlate/window.py" line="244"/> | |
7 | 7 | <source>The Translation Project</source> | |
8 | 8 | <translation>Le Projet de Traduction</translation> | |
9 | 9 | </message> | |
10 | 10 | <message> | |
11 | - | <location filename="../offlate/window.py" line="212"/> | |
11 | + | <location filename="../offlate/window.py" line="252"/> | |
12 | 12 | <source>Cancel</source> | |
13 | 13 | <translation>Annuler</translation> | |
14 | 14 | </message> | |
15 | 15 | <message> | |
16 | - | <location filename="../offlate/window.py" line="213"/> | |
16 | + | <location filename="../offlate/window.py" line="253"/> | |
17 | 17 | <source>OK</source> | |
18 | 18 | <translation>OK</translation> | |
19 | 19 | </message> | |
20 | 20 | <message> | |
21 | - | <location filename="../offlate/window.py" line="195"/> | |
21 | + | <location filename="../offlate/window.py" line="235"/> | |
22 | 22 | <source>Project information</source> | |
23 | 23 | <translation>Informations sur le projet</translation> | |
24 | 24 | </message> | |
25 | 25 | <message> | |
26 | - | <location filename="../offlate/window.py" line="201"/> | |
26 | + | <location filename="../offlate/window.py" line="241"/> | |
27 | 27 | <source>Name:</source> | |
28 | 28 | <translation>Nom :</translation> | |
29 | 29 | </message> | |
30 | 30 | <message> | |
31 | - | <location filename="../offlate/window.py" line="202"/> | |
31 | + | <location filename="../offlate/window.py" line="242"/> | |
32 | 32 | <source>Target Language:</source> | |
33 | 33 | <translation>Langue cible :</translation> | |
34 | 34 | </message> | |
35 | 35 | <message> | |
36 | - | <location filename="../offlate/window.py" line="205"/> | |
36 | + | <location filename="../offlate/window.py" line="245"/> | |
37 | 37 | <source>Transifex</source> | |
38 | 38 | <translation>Transifex</translation> | |
39 | 39 | </message> | |
40 | 40 | <message> | |
41 | - | <location filename="../offlate/window.py" line="227"/> | |
41 | + | <location filename="../offlate/window.py" line="267"/> | |
42 | 42 | <source>Organization</source> | |
43 | 43 | <translation>Organisation</translation> | |
44 | 44 | </message> | |
… | |||
46 | 46 | <context> | |
47 | 47 | <name>ProjectView</name> | |
48 | 48 | <message> | |
49 | - | <location filename="../offlate/window.py" line="112"/> | |
49 | + | <location filename="../offlate/window.py" line="137"/> | |
50 | 50 | <source>Singular</source> | |
51 | 51 | <translation>Singulier</translation> | |
52 | 52 | </message> | |
53 | 53 | <message> | |
54 | - | <location filename="../offlate/window.py" line="113"/> | |
54 | + | <location filename="../offlate/window.py" line="138"/> | |
55 | 55 | <source>Plural</source> | |
56 | 56 | <translation>Pluriel</translation> | |
57 | 57 | </message> | |
… | |||
59 | 59 | <context> | |
60 | 60 | <name>SettingsWindow</name> | |
61 | 61 | <message> | |
62 | - | <location filename="../offlate/window.py" line="318"/> | |
62 | + | <location filename="../offlate/window.py" line="358"/> | |
63 | 63 | <source>Cancel</source> | |
64 | 64 | <translation>Annuler</translation> | |
65 | 65 | </message> | |
66 | 66 | <message> | |
67 | - | <location filename="../offlate/window.py" line="319"/> | |
67 | + | <location filename="../offlate/window.py" line="359"/> | |
68 | 68 | <source>OK</source> | |
69 | 69 | <translation>OK</translation> | |
70 | 70 | </message> | |
71 | 71 | <message> | |
72 | - | <location filename="../offlate/window.py" line="384"/> | |
72 | + | <location filename="../offlate/window.py" line="424"/> | |
73 | 73 | <source>Email:</source> | |
74 | 74 | <translation>Adresse de courriel :</translation> | |
75 | 75 | </message> | |
76 | 76 | <message> | |
77 | - | <location filename="../offlate/window.py" line="385"/> | |
77 | + | <location filename="../offlate/window.py" line="425"/> | |
78 | 78 | <source>Server:</source> | |
79 | 79 | <translation>Serveur :</translation> | |
80 | 80 | </message> | |
81 | 81 | <message> | |
82 | - | <location filename="../offlate/window.py" line="386"/> | |
82 | + | <location filename="../offlate/window.py" line="426"/> | |
83 | 83 | <source>User Name:</source> | |
84 | 84 | <translation>Nom d'utilisateur :</translation> | |
85 | 85 | </message> | |
86 | 86 | <message> | |
87 | - | <location filename="../offlate/window.py" line="330"/> | |
87 | + | <location filename="../offlate/window.py" line="370"/> | |
88 | 88 | <source>Transifex</source> | |
89 | 89 | <translation>Transifex</translation> | |
90 | 90 | </message> | |
91 | 91 | <message> | |
92 | - | <location filename="../offlate/window.py" line="342"/> | |
92 | + | <location filename="../offlate/window.py" line="382"/> | |
93 | 93 | <source>You can get a token from <a href="#">https://www.transifex.com/user/settings/api/</a></source> | |
94 | 94 | <translation>Vous pouvez r??cup??rer un jeton sur <a href="#">https://www.transifex.com/user/settings/api/</a></translation> | |
95 | 95 | </message> | |
96 | 96 | <message> | |
97 | - | <location filename="../offlate/window.py" line="345"/> | |
97 | + | <location filename="../offlate/window.py" line="385"/> | |
98 | 98 | <source>Token:</source> | |
99 | 99 | <translation>Jeton :</translation> | |
100 | 100 | </message> | |
101 | 101 | <message> | |
102 | - | <location filename="../offlate/window.py" line="359"/> | |
102 | + | <location filename="../offlate/window.py" line="399"/> | |
103 | 103 | <source>Translation Project</source> | |
104 | 104 | <translation>Projet de traduction</translation> | |
105 | 105 | </message> | |
106 | 106 | <message> | |
107 | - | <location filename="../offlate/window.py" line="387"/> | |
107 | + | <location filename="../offlate/window.py" line="427"/> | |
108 | 108 | <source>Full Name (John Doe <john@doe.me>):</source> | |
109 | 109 | <translation>Nom complet (Jean Dupont <jean@dupont.me>) :</translation> | |
110 | 110 | </message> | |
… | |||
125 | 125 | <context> | |
126 | 126 | <name>Window</name> | |
127 | 127 | <message> | |
128 | - | <location filename="../offlate/window.py" line="459"/> | |
128 | + | <location filename="../offlate/window.py" line="527"/> | |
129 | 129 | <source>Exit application</source> | |
130 | 130 | <translation>Quitter l'application</translation> | |
131 | 131 | </message> | |
132 | 132 | <message> | |
133 | - | <location filename="../offlate/window.py" line="464"/> | |
133 | + | <location filename="../offlate/window.py" line="532"/> | |
134 | 134 | <source>Save current project</source> | |
135 | 135 | <translation>Sauvegarder le projet actuel</translation> | |
136 | 136 | </message> | |
137 | 137 | <message> | |
138 | - | <location filename="../offlate/window.py" line="469"/> | |
138 | + | <location filename="../offlate/window.py" line="537"/> | |
139 | 139 | <source>New project</source> | |
140 | 140 | <translation>Nouveau projet</translation> | |
141 | 141 | </message> | |
142 | 142 | <message> | |
143 | - | <location filename="../offlate/window.py" line="474"/> | |
143 | + | <location filename="../offlate/window.py" line="542"/> | |
144 | 144 | <source>Get modifications from upstream</source> | |
145 | 145 | <translation>R??cup??rer les modifications en amont</translation> | |
146 | 146 | </message> | |
147 | 147 | <message> | |
148 | - | <location filename="../offlate/window.py" line="478"/> | |
148 | + | <location filename="../offlate/window.py" line="546"/> | |
149 | 149 | <source>Close current project</source> | |
150 | 150 | <translation>Fermer le projet actuel</translation> | |
151 | 151 | </message> | |
152 | 152 | <message> | |
153 | - | <location filename="../offlate/window.py" line="483"/> | |
153 | + | <location filename="../offlate/window.py" line="551"/> | |
154 | 154 | <source>Send modifications upstream</source> | |
155 | 155 | <translation>Envoyer les modifications en amont</translation> | |
156 | 156 | </message> | |
157 | 157 | <message> | |
158 | - | <location filename="../offlate/window.py" line="488"/> | |
158 | + | <location filename="../offlate/window.py" line="556"/> | |
159 | 159 | <source>Set parameters</source> | |
160 | 160 | <translation>Configurer les param??tres</translation> | |
161 | 161 | </message> | |
162 | 162 | <message> | |
163 | - | <location filename="../offlate/window.py" line="491"/> | |
163 | + | <location filename="../offlate/window.py" line="559"/> | |
164 | 164 | <source>Show Translated</source> | |
165 | 165 | <translation>Montrer traduites</translation> | |
166 | 166 | </message> | |
167 | 167 | <message> | |
168 | - | <location filename="../offlate/window.py" line="494"/> | |
168 | + | <location filename="../offlate/window.py" line="562"/> | |
169 | 169 | <source>Show Fuzzy</source> | |
170 | 170 | <translation>Montrer floues</translation> | |
171 | 171 | </message> | |
172 | 172 | <message> | |
173 | - | <location filename="../offlate/window.py" line="497"/> | |
173 | + | <location filename="../offlate/window.py" line="565"/> | |
174 | 174 | <source>Show Empty Translation</source> | |
175 | 175 | <translation>Montrer les traductions vides</translation> | |
176 | 176 | </message> | |
177 | 177 | <message> | |
178 | - | <location filename="../offlate/window.py" line="507"/> | |
178 | + | <location filename="../offlate/window.py" line="583"/> | |
179 | 179 | <source>&File</source> | |
180 | 180 | <translation>&Fichier</translation> | |
181 | 181 | </message> | |
182 | 182 | <message> | |
183 | - | <location filename="../offlate/window.py" line="513"/> | |
183 | + | <location filename="../offlate/window.py" line="589"/> | |
184 | 184 | <source>&Project</source> | |
185 | 185 | <translation>&Projet</translation> | |
186 | 186 | </message> | |
187 | 187 | <message> | |
188 | - | <location filename="../offlate/window.py" line="520"/> | |
188 | + | <location filename="../offlate/window.py" line="596"/> | |
189 | 189 | <source>&Edit</source> | |
190 | 190 | <translation>&??dition</translation> | |
191 | 191 | </message> | |
192 | 192 | <message> | |
193 | - | <location filename="../offlate/window.py" line="523"/> | |
193 | + | <location filename="../offlate/window.py" line="599"/> | |
194 | 194 | <source>&View</source> | |
195 | 195 | <translation>&Affichage</translation> | |
196 | 196 | </message> | |
197 | 197 | <message> | |
198 | - | <location filename="../offlate/window.py" line="503"/> | |
198 | + | <location filename="../offlate/window.py" line="579"/> | |
199 | 199 | <source>Open</source> | |
200 | 200 | <translation>Ouvrir</translation> | |
201 | 201 | </message> | |
202 | 202 | <message> | |
203 | - | <location filename="../offlate/window.py" line="457"/> | |
203 | + | <location filename="../offlate/window.py" line="525"/> | |
204 | 204 | <source>Exit</source> | |
205 | 205 | <translation>Quitter</translation> | |
206 | 206 | </message> | |
207 | 207 | <message> | |
208 | - | <location filename="../offlate/window.py" line="462"/> | |
208 | + | <location filename="../offlate/window.py" line="530"/> | |
209 | 209 | <source>Save</source> | |
210 | 210 | <translation>Sauvegarder</translation> | |
211 | 211 | </message> | |
212 | 212 | <message> | |
213 | - | <location filename="../offlate/window.py" line="467"/> | |
213 | + | <location filename="../offlate/window.py" line="535"/> | |
214 | 214 | <source>New</source> | |
215 | 215 | <translation>Nouveau</translation> | |
216 | 216 | </message> | |
217 | 217 | <message> | |
218 | - | <location filename="../offlate/window.py" line="472"/> | |
218 | + | <location filename="../offlate/window.py" line="540"/> | |
219 | 219 | <source>Update</source> | |
220 | 220 | <translation>Mettre ?? jour</translation> | |
221 | 221 | </message> | |
222 | 222 | <message> | |
223 | - | <location filename="../offlate/window.py" line="477"/> | |
223 | + | <location filename="../offlate/window.py" line="545"/> | |
224 | 224 | <source>Close</source> | |
225 | 225 | <translation>Fermer</translation> | |
226 | 226 | </message> | |
227 | 227 | <message> | |
228 | - | <location filename="../offlate/window.py" line="481"/> | |
228 | + | <location filename="../offlate/window.py" line="549"/> | |
229 | 229 | <source>Send</source> | |
230 | 230 | <translation>Envoyer</translation> | |
231 | 231 | </message> | |
232 | 232 | <message> | |
233 | - | <location filename="../offlate/window.py" line="486"/> | |
233 | + | <location filename="../offlate/window.py" line="554"/> | |
234 | 234 | <source>Settings</source> | |
235 | 235 | <translation>Param??tres</translation> | |
236 | 236 | </message> | |
237 | + | <message> | |
238 | + | <location filename="../offlate/window.py" line="568"/> | |
239 | + | <source>Use a monospace font</source> | |
240 | + | <translation type="unfinished"></translation> | |
241 | + | </message> | |
242 | + | <message> | |
243 | + | <location filename="../offlate/window.py" line="478"/> | |
244 | + | <source>{} translated on {} total ({}%).</source> | |
245 | + | <translation type="unfinished"></translation> | |
246 | + | </message> | |
237 | 247 | </context> | |
238 | 248 | <context> | |
239 | 249 | <name>self.qd</name> | |
240 | 250 | <message> | |
241 | - | <location filename="../offlate/window.py" line="26"/> | |
251 | + | <location filename="../offlate/window.py" line="27"/> | |
242 | 252 | <source>Please enter your password:</source> | |
243 | 253 | <translation>Veuillez entrer votre mot de passe :</translation> | |
244 | 254 | </message> |
offlate/window.py
6 | 6 | import json | |
7 | 7 | import re | |
8 | 8 | import os | |
9 | + | import math | |
9 | 10 | ||
10 | 11 | from .manager import ProjectManager | |
11 | 12 | from .spellcheckedit import SpellCheckEdit | |
… | |||
30 | 31 | return self.value | |
31 | 32 | ||
32 | 33 | class ProjectView(QWidget): | |
34 | + | translationModified = pyqtSignal() | |
35 | + | ||
33 | 36 | def __init__(self, project, showTranslated = True, showUntranslated = True, | |
34 | 37 | showFuzzy = True, monospace = False, parent = None): | |
35 | 38 | super(ProjectView, self).__init__(parent) | |
… | |||
71 | 74 | item.setData(0, Qt.UserRole, entry) | |
72 | 75 | items.append(item) | |
73 | 76 | self.treeWidget.insertTopLevelItems(0, items) | |
77 | + | self.translationModified.emit() | |
74 | 78 | ||
75 | 79 | def initUI(self): | |
76 | 80 | vbox = QVBoxLayout() | |
… | |||
170 | 174 | item.setBackground(1, QBrush()) | |
171 | 175 | else: | |
172 | 176 | item.setBackground(1, self.emptyColor) | |
177 | + | self.translationModified.emit() | |
178 | + | ||
173 | 179 | ||
174 | 180 | def save(self): | |
175 | 181 | self.project.save() | |
… | |||
448 | 454 | ||
449 | 455 | def open(self, name): | |
450 | 456 | project = self.manager.getProject(name) | |
451 | - | self.tabs.addTab(ProjectView(project, | |
457 | + | tab = ProjectView(project, | |
452 | 458 | showTranslated = self.showTranslatedAct.isChecked(), | |
453 | 459 | showUntranslated = self.showUntranslatedAct.isChecked(), | |
454 | 460 | showFuzzy = self.showFuzzyAct.isChecked(), | |
455 | - | monospace = self.monospaceAct.isChecked()), name) | |
461 | + | monospace = self.monospaceAct.isChecked()) | |
462 | + | tab.translationModified.connect(self.count) | |
463 | + | self.tabs.addTab(tab, name) | |
464 | + | self.count() | |
465 | + | ||
466 | + | def count(self, item = -1): | |
467 | + | widget = self.tabs.currentWidget() | |
468 | + | content = widget.content[widget.currentContent] | |
469 | + | total = 0 | |
470 | + | translated = 0 | |
471 | + | for d in content: | |
472 | + | total += 1 | |
473 | + | if d.isTranslated() and not d.isFuzzy(): | |
474 | + | translated += 1 | |
475 | + | percent = 100 if total == 0 else math.floor(100 * translated / total) | |
476 | + | self.countLabel.setText(self.tr("{} translated on {} total ({}%).").format(translated, total, percent)) | |
456 | 477 | ||
457 | 478 | def save(self): | |
458 | 479 | self.tabs.currentWidget().save() | |
… | |||
549 | 570 | self.nextShortcut = QShortcut(QKeySequence("Ctrl+Return"), self) | |
550 | 571 | self.nextShortcut.activated.connect(self.nextItem) | |
551 | 572 | ||
573 | + | self.countLabel = QLabel() | |
552 | 574 | self.statusBar() | |
575 | + | self.statusBar().addWidget(self.countLabel) | |
553 | 576 | ||
554 | 577 | openMenu = QMenu(self.tr('Open'), self) | |
555 | 578 | self.initOpenProjects(openMenu) | |
… | |||
579 | 602 | viewMenu.addAction(self.monospaceAct) | |
580 | 603 | ||
581 | 604 | self.tabs = ProjectTab() | |
605 | + | self.tabs.currentChanged.connect(self.count) | |
582 | 606 | ||
583 | 607 | self.setCentralWidget(self.tabs) | |
584 | 608 |