Factorize lang settings UI
offlate/locales/offlate_en.ts
350 | 350 | <context> | |
351 | 351 | <name>PageCopyright</name> | |
352 | 352 | <message> | |
353 | - | <location filename="../ui/welcome.py" line="99"/> | |
353 | + | <location filename="../ui/welcome.py" line="98"/> | |
354 | 354 | <source>Copyright Settings</source> | |
355 | 355 | <translation type="unfinished"></translation> | |
356 | 356 | </message> | |
357 | 357 | <message> | |
358 | - | <location filename="../ui/welcome.py" line="100"/> | |
358 | + | <location filename="../ui/welcome.py" line="99"/> | |
359 | 359 | <source>Configuring how your copyright is added to files</source> | |
360 | 360 | <translation type="unfinished"></translation> | |
361 | 361 | </message> | |
362 | - | <message> | |
363 | - | <location filename="../ui/welcome.py" line="103"/> | |
364 | - | <source>In some cases, we need to add a copyright line for you in the translation files we send upstream. Here, you can configure how you want the copyright line to look like. This information will most likely become public after your first contribution.</source> | |
365 | - | <translation type="unfinished"></translation> | |
366 | - | </message> | |
367 | - | <message> | |
368 | - | <location filename="../ui/welcome.py" line="120"/> | |
369 | - | <source>Here is how your copyright line will look like:</source> | |
370 | - | <translation type="unfinished"></translation> | |
371 | - | </message> | |
372 | - | <message> | |
373 | - | <location filename="../ui/welcome.py" line="149"/> | |
374 | - | <source>Your Name</source> | |
375 | - | <translation type="unfinished"></translation> | |
376 | - | </message> | |
377 | - | <message> | |
378 | - | <location filename="../ui/welcome.py" line="151"/> | |
379 | - | <source>your@email</source> | |
380 | - | <translation type="unfinished"></translation> | |
381 | - | </message> | |
382 | - | <message> | |
383 | - | <location filename="../ui/welcome.py" line="152"/> | |
384 | - | <source>Copyright &copy; {} {} &lt;{}&gt;</source> | |
385 | - | <translation type="unfinished"></translation> | |
386 | - | </message> | |
387 | 362 | </context> | |
388 | 363 | <context> | |
389 | 364 | <name>PageDownload</name> | |
390 | 365 | <message> | |
391 | - | <location filename="../ui/welcome.py" line="261"/> | |
366 | + | <location filename="../ui/welcome.py" line="187"/> | |
392 | 367 | <source>Project Fetch</source> | |
393 | 368 | <translation type="unfinished"></translation> | |
394 | 369 | </message> | |
395 | 370 | <message> | |
396 | - | <location filename="../ui/welcome.py" line="262"/> | |
371 | + | <location filename="../ui/welcome.py" line="188"/> | |
397 | 372 | <source>Downloading translation files</source> | |
398 | 373 | <translation type="unfinished"></translation> | |
399 | 374 | </message> | |
400 | 375 | <message> | |
401 | - | <location filename="../ui/welcome.py" line="265"/> | |
376 | + | <location filename="../ui/welcome.py" line="191"/> | |
402 | 377 | <source>We are now attempting to fetch the translation files of your project. This step should be pretty fast.</source> | |
403 | 378 | <translation type="unfinished"></translation> | |
404 | 379 | </message> | |
405 | 380 | <message> | |
406 | - | <location filename="../ui/welcome.py" line="295"/> | |
381 | + | <location filename="../ui/welcome.py" line="221"/> | |
407 | 382 | <source>Finished!</source> | |
408 | 383 | <translation type="unfinished"></translation> | |
409 | 384 | </message> | |
… | |||
411 | 386 | <context> | |
412 | 387 | <name>PageHints</name> | |
413 | 388 | <message> | |
414 | - | <location filename="../ui/welcome.py" line="375"/> | |
389 | + | <location filename="../ui/welcome.py" line="301"/> | |
415 | 390 | <source>You can always go back to the initial screen (called the project manager) from the editor, by using <i>file > project manager</i></source> | |
416 | 391 | <translation type="unfinished"></translation> | |
417 | 392 | </message> | |
418 | 393 | <message> | |
419 | - | <location filename="../ui/welcome.py" line="384"/> | |
394 | + | <location filename="../ui/welcome.py" line="310"/> | |
420 | 395 | <source>Quickly switch to the next string with <i>Ctrl+Enter</i>. Use <i>Ctrl+Shift+Enter</i> to go back to the previous string instead.</source> | |
421 | 396 | <translation type="unfinished"></translation> | |
422 | 397 | </message> | |
423 | 398 | <message> | |
424 | - | <location filename="../ui/welcome.py" line="393"/> | |
399 | + | <location filename="../ui/welcome.py" line="319"/> | |
425 | 400 | <source>With these hints, you are now ready to start working on your project! We will now open the project manager, from which you can add more projects, change your settings, etc. Have fun!</source> | |
426 | 401 | <translation type="unfinished"></translation> | |
427 | 402 | </message> | |
… | |||
429 | 404 | <context> | |
430 | 405 | <name>PageLang</name> | |
431 | 406 | <message> | |
432 | - | <location filename="../ui/welcome.py" line="163"/> | |
407 | + | <location filename="../ui/welcome.py" line="117"/> | |
433 | 408 | <source>Language Settings</source> | |
434 | 409 | <translation type="unfinished"></translation> | |
435 | 410 | </message> | |
436 | 411 | <message> | |
437 | - | <location filename="../ui/welcome.py" line="164"/> | |
412 | + | <location filename="../ui/welcome.py" line="118"/> | |
438 | 413 | <source>Configuring the default language for new projects</source> | |
439 | 414 | <translation type="unfinished"></translation> | |
440 | 415 | </message> | |
441 | - | <message> | |
442 | - | <location filename="../ui/welcome.py" line="167"/> | |
443 | - | <source>Which language will you most frequently translate projects into? This setting can be changed later. It can also be overriden by individual projects.</source> | |
444 | - | <translation type="unfinished"></translation> | |
445 | - | </message> | |
446 | - | <message> | |
447 | - | <location filename="../ui/welcome.py" line="174"/> | |
448 | - | <source>None</source> | |
449 | - | <translation type="unfinished"></translation> | |
450 | - | </message> | |
451 | - | <message> | |
452 | - | <location filename="../ui/welcome.py" line="186"/> | |
453 | - | <source>Note that you should only translate into native language or to a language you are extremely familiar with, to avoid weird or nonsensical translations.</source> | |
454 | - | <translation type="unfinished"></translation> | |
455 | - | </message> | |
456 | 416 | </context> | |
457 | 417 | <context> | |
458 | 418 | <name>PageProjectSelection</name> | |
459 | 419 | <message> | |
460 | - | <location filename="../ui/welcome.py" line="214"/> | |
420 | + | <location filename="../ui/welcome.py" line="140"/> | |
461 | 421 | <source>First Project</source> | |
462 | 422 | <translation type="unfinished"></translation> | |
463 | 423 | </message> | |
464 | 424 | <message> | |
465 | - | <location filename="../ui/welcome.py" line="215"/> | |
425 | + | <location filename="../ui/welcome.py" line="141"/> | |
466 | 426 | <source>Choosing a first project</source> | |
467 | 427 | <translation type="unfinished"></translation> | |
468 | 428 | </message> | |
… | |||
470 | 430 | <context> | |
471 | 431 | <name>PageSuccess</name> | |
472 | 432 | <message> | |
473 | - | <location filename="../ui/welcome.py" line="352"/> | |
433 | + | <location filename="../ui/welcome.py" line="278"/> | |
474 | 434 | <source>Congratulations! We've just set up your first project! Initial setup is now complete, and you can always change the settings you've set here from the Offlate welcome screen. After a few explanations you will be able to work on your project right away!</source> | |
475 | 435 | <translation type="unfinished"></translation> | |
476 | 436 | </message> | |
… | |||
478 | 438 | <context> | |
479 | 439 | <name>PageSystemSettings</name> | |
480 | 440 | <message> | |
481 | - | <location filename="../ui/welcome.py" line="237"/> | |
441 | + | <location filename="../ui/welcome.py" line="163"/> | |
482 | 442 | <source>System Configuration</source> | |
483 | 443 | <translation type="unfinished"></translation> | |
484 | 444 | </message> | |
485 | 445 | <message> | |
486 | - | <location filename="../ui/welcome.py" line="238"/> | |
446 | + | <location filename="../ui/welcome.py" line="164"/> | |
487 | 447 | <source>Getting an account on the project's platform</source> | |
488 | 448 | <translation type="unfinished"></translation> | |
489 | 449 | </message> | |
… | |||
491 | 451 | <context> | |
492 | 452 | <name>PageWelcome</name> | |
493 | 453 | <message> | |
494 | - | <location filename="../ui/welcome.py" line="82"/> | |
454 | + | <location filename="../ui/welcome.py" line="81"/> | |
495 | 455 | <source>Offlate is a tool to help you localise free and open source software. Before you start contributing translations to a project though, there are a few things we need to set up and talk about. Let's get started!</source> | |
496 | 456 | <translation type="unfinished"></translation> | |
497 | 457 | </message> | |
… | |||
753 | 713 | <context> | |
754 | 714 | <name>WelcomeWindow</name> | |
755 | 715 | <message> | |
756 | - | <location filename="../ui/welcome.py" line="63"/> | |
716 | + | <location filename="../ui/welcome.py" line="62"/> | |
757 | 717 | <source>Welcome to Offlate</source> | |
758 | 718 | <translation type="unfinished"></translation> | |
759 | 719 | </message> |
offlate/locales/offlate_fr.ts
352 | 352 | <context> | |
353 | 353 | <name>PageCopyright</name> | |
354 | 354 | <message> | |
355 | - | <location filename="../ui/welcome.py" line="99"/> | |
355 | + | <location filename="../ui/welcome.py" line="98"/> | |
356 | 356 | <source>Copyright Settings</source> | |
357 | 357 | <translation type="unfinished"></translation> | |
358 | 358 | </message> | |
359 | 359 | <message> | |
360 | - | <location filename="../ui/welcome.py" line="100"/> | |
360 | + | <location filename="../ui/welcome.py" line="99"/> | |
361 | 361 | <source>Configuring how your copyright is added to files</source> | |
362 | 362 | <translation type="unfinished"></translation> | |
363 | 363 | </message> | |
364 | - | <message> | |
365 | - | <location filename="../ui/welcome.py" line="103"/> | |
366 | - | <source>In some cases, we need to add a copyright line for you in the translation files we send upstream. Here, you can configure how you want the copyright line to look like. This information will most likely become public after your first contribution.</source> | |
367 | - | <translation type="unfinished"></translation> | |
368 | - | </message> | |
369 | - | <message> | |
370 | - | <location filename="../ui/welcome.py" line="120"/> | |
371 | - | <source>Here is how your copyright line will look like:</source> | |
372 | - | <translation type="unfinished"></translation> | |
373 | - | </message> | |
374 | - | <message> | |
375 | - | <location filename="../ui/welcome.py" line="149"/> | |
376 | - | <source>Your Name</source> | |
377 | - | <translation type="unfinished"></translation> | |
378 | - | </message> | |
379 | - | <message> | |
380 | - | <location filename="../ui/welcome.py" line="151"/> | |
381 | - | <source>your@email</source> | |
382 | - | <translation type="unfinished"></translation> | |
383 | - | </message> | |
384 | - | <message> | |
385 | - | <location filename="../ui/welcome.py" line="152"/> | |
386 | - | <source>Copyright &copy; {} {} &lt;{}&gt;</source> | |
387 | - | <translation type="unfinished"></translation> | |
388 | - | </message> | |
389 | 364 | </context> | |
390 | 365 | <context> | |
391 | 366 | <name>PageDownload</name> | |
392 | 367 | <message> | |
393 | - | <location filename="../ui/welcome.py" line="261"/> | |
368 | + | <location filename="../ui/welcome.py" line="187"/> | |
394 | 369 | <source>Project Fetch</source> | |
395 | 370 | <translation type="unfinished"></translation> | |
396 | 371 | </message> | |
397 | 372 | <message> | |
398 | - | <location filename="../ui/welcome.py" line="262"/> | |
373 | + | <location filename="../ui/welcome.py" line="188"/> | |
399 | 374 | <source>Downloading translation files</source> | |
400 | 375 | <translation type="unfinished"></translation> | |
401 | 376 | </message> | |
402 | 377 | <message> | |
403 | - | <location filename="../ui/welcome.py" line="265"/> | |
378 | + | <location filename="../ui/welcome.py" line="191"/> | |
404 | 379 | <source>We are now attempting to fetch the translation files of your project. This step should be pretty fast.</source> | |
405 | 380 | <translation type="unfinished"></translation> | |
406 | 381 | </message> | |
407 | 382 | <message> | |
408 | - | <location filename="../ui/welcome.py" line="295"/> | |
383 | + | <location filename="../ui/welcome.py" line="221"/> | |
409 | 384 | <source>Finished!</source> | |
410 | 385 | <translation type="unfinished"></translation> | |
411 | 386 | </message> | |
… | |||
413 | 388 | <context> | |
414 | 389 | <name>PageHints</name> | |
415 | 390 | <message> | |
416 | - | <location filename="../ui/welcome.py" line="375"/> | |
391 | + | <location filename="../ui/welcome.py" line="301"/> | |
417 | 392 | <source>You can always go back to the initial screen (called the project manager) from the editor, by using <i>file > project manager</i></source> | |
418 | 393 | <translation type="unfinished"></translation> | |
419 | 394 | </message> | |
420 | 395 | <message> | |
421 | - | <location filename="../ui/welcome.py" line="384"/> | |
396 | + | <location filename="../ui/welcome.py" line="310"/> | |
422 | 397 | <source>Quickly switch to the next string with <i>Ctrl+Enter</i>. Use <i>Ctrl+Shift+Enter</i> to go back to the previous string instead.</source> | |
423 | 398 | <translation type="unfinished"></translation> | |
424 | 399 | </message> | |
425 | 400 | <message> | |
426 | - | <location filename="../ui/welcome.py" line="393"/> | |
401 | + | <location filename="../ui/welcome.py" line="319"/> | |
427 | 402 | <source>With these hints, you are now ready to start working on your project! We will now open the project manager, from which you can add more projects, change your settings, etc. Have fun!</source> | |
428 | 403 | <translation type="unfinished"></translation> | |
429 | 404 | </message> | |
… | |||
431 | 406 | <context> | |
432 | 407 | <name>PageLang</name> | |
433 | 408 | <message> | |
434 | - | <location filename="../ui/welcome.py" line="163"/> | |
409 | + | <location filename="../ui/welcome.py" line="117"/> | |
435 | 410 | <source>Language Settings</source> | |
436 | 411 | <translation type="unfinished"></translation> | |
437 | 412 | </message> | |
438 | 413 | <message> | |
439 | - | <location filename="../ui/welcome.py" line="164"/> | |
414 | + | <location filename="../ui/welcome.py" line="118"/> | |
440 | 415 | <source>Configuring the default language for new projects</source> | |
441 | 416 | <translation type="unfinished"></translation> | |
442 | 417 | </message> | |
443 | - | <message> | |
444 | - | <location filename="../ui/welcome.py" line="167"/> | |
445 | - | <source>Which language will you most frequently translate projects into? This setting can be changed later. It can also be overriden by individual projects.</source> | |
446 | - | <translation type="unfinished"></translation> | |
447 | - | </message> | |
448 | - | <message> | |
449 | - | <location filename="../ui/welcome.py" line="174"/> | |
450 | - | <source>None</source> | |
451 | - | <translation type="unfinished"></translation> | |
452 | - | </message> | |
453 | - | <message> | |
454 | - | <location filename="../ui/welcome.py" line="186"/> | |
455 | - | <source>Note that you should only translate into native language or to a language you are extremely familiar with, to avoid weird or nonsensical translations.</source> | |
456 | - | <translation type="unfinished"></translation> | |
457 | - | </message> | |
458 | 418 | </context> | |
459 | 419 | <context> | |
460 | 420 | <name>PageProjectSelection</name> | |
461 | 421 | <message> | |
462 | - | <location filename="../ui/welcome.py" line="214"/> | |
422 | + | <location filename="../ui/welcome.py" line="140"/> | |
463 | 423 | <source>First Project</source> | |
464 | 424 | <translation type="unfinished"></translation> | |
465 | 425 | </message> | |
466 | 426 | <message> | |
467 | - | <location filename="../ui/welcome.py" line="215"/> | |
427 | + | <location filename="../ui/welcome.py" line="141"/> | |
468 | 428 | <source>Choosing a first project</source> | |
469 | 429 | <translation type="unfinished"></translation> | |
470 | 430 | </message> | |
… | |||
472 | 432 | <context> | |
473 | 433 | <name>PageSuccess</name> | |
474 | 434 | <message> | |
475 | - | <location filename="../ui/welcome.py" line="352"/> | |
435 | + | <location filename="../ui/welcome.py" line="278"/> | |
476 | 436 | <source>Congratulations! We've just set up your first project! Initial setup is now complete, and you can always change the settings you've set here from the Offlate welcome screen. After a few explanations you will be able to work on your project right away!</source> | |
477 | 437 | <translation type="unfinished"></translation> | |
478 | 438 | </message> | |
… | |||
480 | 440 | <context> | |
481 | 441 | <name>PageSystemSettings</name> | |
482 | 442 | <message> | |
483 | - | <location filename="../ui/welcome.py" line="237"/> | |
443 | + | <location filename="../ui/welcome.py" line="163"/> | |
484 | 444 | <source>System Configuration</source> | |
485 | 445 | <translation type="unfinished"></translation> | |
486 | 446 | </message> | |
487 | 447 | <message> | |
488 | - | <location filename="../ui/welcome.py" line="238"/> | |
448 | + | <location filename="../ui/welcome.py" line="164"/> | |
489 | 449 | <source>Getting an account on the project's platform</source> | |
490 | 450 | <translation type="unfinished"></translation> | |
491 | 451 | </message> | |
… | |||
493 | 453 | <context> | |
494 | 454 | <name>PageWelcome</name> | |
495 | 455 | <message> | |
496 | - | <location filename="../ui/welcome.py" line="82"/> | |
456 | + | <location filename="../ui/welcome.py" line="81"/> | |
497 | 457 | <source>Offlate is a tool to help you localise free and open source software. Before you start contributing translations to a project though, there are a few things we need to set up and talk about. Let's get started!</source> | |
498 | 458 | <translation type="unfinished"></translation> | |
499 | 459 | </message> | |
… | |||
755 | 715 | <context> | |
756 | 716 | <name>WelcomeWindow</name> | |
757 | 717 | <message> | |
758 | - | <location filename="../ui/welcome.py" line="63"/> | |
718 | + | <location filename="../ui/welcome.py" line="62"/> | |
759 | 719 | <source>Welcome to Offlate</source> | |
760 | 720 | <translation type="unfinished"></translation> | |
761 | 721 | </message> |
offlate/ui/config/settings.py
23 | 23 | from PyQt5.QtGui import * | |
24 | 24 | from PyQt5.QtCore import * | |
25 | 25 | ||
26 | + | from translate.lang.data import languages, tr_lang | |
27 | + | ||
26 | 28 | from ...systems.list import systems | |
27 | 29 | from ...core.manager import ProjectManager | |
28 | 30 | from ...core.config import * | |
… | |||
43 | 45 | ||
44 | 46 | def initUI(self): | |
45 | 47 | center = QDesktopWidget().availableGeometry().center() | |
46 | - | self.setGeometry(center.x()-200, center.y()-400, 400, 600) | |
48 | + | self.setGeometry(center.x()-200, center.y()-400, 400, 800) | |
47 | 49 | self.setWindowTitle(self.tr('Offlate Settings')) | |
48 | 50 | self.welcomeWidget = SettingsWidget(self, self.manager) | |
49 | 51 | self.setCentralWidget(self.welcomeWidget) | |
50 | 52 | ||
53 | + | def show(self): | |
54 | + | self.welcomeWidget.show() | |
55 | + | super().show() | |
56 | + | ||
51 | 57 | class SystemSettingsWidget(QWidget): | |
52 | 58 | def __init__(self, manager, system = -1, parent=None): | |
53 | 59 | super().__init__(parent) | |
… | |||
146 | 152 | self.nameWidget.setPlaceholderText(self.tr("John Doe")) | |
147 | 153 | self.emailWidget = QLineEdit() | |
148 | 154 | self.emailWidget.setText(self.email) | |
149 | - | self.nameWidget.setPlaceholderText(self.tr("john@doe.me")) | |
155 | + | self.emailWidget.setPlaceholderText(self.tr("john@doe.me")) | |
150 | 156 | form.addRow(QLabel("Name:"), self.nameWidget) | |
151 | 157 | form.addRow(QLabel("Email:"), self.emailWidget) | |
152 | 158 | layout.addLayout(form) | |
… | |||
186 | 192 | self.previewLine.setText(self.tr("Copyright © {} {} <{}>").format(year, | |
187 | 193 | name if name != "" else nameHolder, email if email != "" else emailHolder)) | |
188 | 194 | ||
195 | + | class LangSettingsWidget(QWidget): | |
196 | + | changed = pyqtSignal(str) | |
197 | + | ||
198 | + | def __init__(self, lang="", parent=None): | |
199 | + | super().__init__(parent) | |
200 | + | self.lang = lang | |
201 | + | self.initUI() | |
202 | + | ||
203 | + | def initUI(self): | |
204 | + | layout = QVBoxLayout() | |
205 | + | ||
206 | + | explainText = QLabel(self) | |
207 | + | explainText.setText(self.tr("Which language will you most frequently \ | |
208 | + | translate projects into? This setting can be overriden in each individual \ | |
209 | + | projects.")) | |
210 | + | explainText.setWordWrap(True) | |
211 | + | layout.addWidget(explainText) | |
212 | + | ||
213 | + | self.languageCombo = QComboBox() | |
214 | + | self.languageCombo.addItem(self.tr("None"), userData="") | |
215 | + | i = 1 | |
216 | + | langIndex = 0 | |
217 | + | for lang in languages: | |
218 | + | langtag = lang | |
219 | + | lang = languages[lang] | |
220 | + | langname = lang[0] | |
221 | + | self.languageCombo.addItem(tr_lang()(langname), userData=langtag) | |
222 | + | if langtag == self.lang: | |
223 | + | langIndex = i | |
224 | + | i += 1 | |
225 | + | self.languageCombo.setCurrentIndex(langIndex) | |
226 | + | self.languageCombo.currentIndexChanged.connect(self.comboChanged) | |
227 | + | layout.addWidget(self.languageCombo) | |
228 | + | ||
229 | + | layout.addSpacing(15) | |
230 | + | ||
231 | + | warnText = QLabel(self) | |
232 | + | warnText.setText(self.tr("Note that you should only translate into \ | |
233 | + | native language or to a language you are extremely familiar with, to avoid \ | |
234 | + | weird or nonsensical translations.")) | |
235 | + | warnText.setWordWrap(True) | |
236 | + | layout.addWidget(warnText) | |
237 | + | ||
238 | + | # TODO: Add information about the selected language, to redirect users | |
239 | + | # to translation teams, resources, etc | |
240 | + | ||
241 | + | # TODO: Allow users to select an unlisted language, by providing | |
242 | + | # language codes. | |
243 | + | ||
244 | + | self.setLayout(layout) | |
245 | + | ||
246 | + | def comboChanged(self, index): | |
247 | + | self.changed.emit(self.languageCombo.itemData(index)) | |
248 | + | ||
249 | + | def getLang(self): | |
250 | + | return self.languageCombo.itemData(self.languageCombo.currentIndex()) | |
251 | + | ||
189 | 252 | class SettingsWidget(QWidget): | |
190 | 253 | def __init__(self, parent=None, manager=None): | |
191 | 254 | super().__init__(parent) | |
192 | 255 | self.parent = parent | |
193 | 256 | self.manager = manager | |
257 | + | ||
258 | + | def show(self): | |
194 | 259 | self.initUI() | |
260 | + | super().show() | |
195 | 261 | ||
196 | 262 | def initUI(self): | |
197 | 263 | vbox = QVBoxLayout() | |
… | |||
200 | 266 | self.manager.getConf(['Generic', 'email'])) | |
201 | 267 | vbox.addWidget(self.copyright) | |
202 | 268 | ||
269 | + | self.lang = LangSettingsWidget(self.manager.getConf(['Generic', 'lang'])) | |
270 | + | vbox.addWidget(self.lang) | |
271 | + | ||
203 | 272 | systemsbox = QGridLayout() | |
204 | 273 | x = 0 | |
205 | 274 | y = 0 | |
… | |||
249 | 318 | def done(self): | |
250 | 319 | name = self.copyright.nameWidget.text() | |
251 | 320 | email = self.copyright.emailWidget.text() | |
321 | + | lang = self.lang.getLang() | |
252 | 322 | if name == None or name == "": | |
253 | 323 | return | |
254 | 324 | if email == None or email == "": | |
255 | 325 | return | |
256 | 326 | ||
257 | - | self.manager.updateSettings({'Generic': {'name': name, 'email': email, 'new': 'False'}}) | |
327 | + | self.manager.updateSettings({'Generic': {'name': name, 'email': email, | |
328 | + | 'lang': lang, 'new': 'False'}}) | |
258 | 329 | self.quit() | |
259 | 330 | ||
260 | 331 | def quit(self): |
offlate/ui/welcome.py
21 | 21 | import sys | |
22 | 22 | import os | |
23 | 23 | ||
24 | - | from translate.lang.data import languages, tr_lang | |
25 | 24 | from .new import PredefinedProjectWidget, AdvancedProjectWidget | |
26 | 25 | from .manager import NewRunnable | |
27 | - | from .config.settings import SystemSettingsWidget | |
26 | + | from .config.settings import SystemSettingsWidget, CopyrightSettingsWidget, \ | |
27 | + | LangSettingsWidget | |
28 | 28 | ||
29 | 29 | WelcomePage = 1 | |
30 | 30 | CopyrightPage = 2 | |
… | |||
117 | 117 | self.setTitle(self.tr("Language Settings")) | |
118 | 118 | self.setSubTitle(self.tr("Configuring the default language for new projects")) | |
119 | 119 | ||
120 | - | explainText = QLabel(self) | |
121 | - | explainText.setText(self.tr("Which language will you most frequently \ | |
122 | - | translate projects into? This setting can be changed later. It can also be \ | |
123 | - | overriden by individual projects.")) | |
124 | - | explainText.setWordWrap(True) | |
125 | - | layout.addWidget(explainText) | |
126 | - | ||
127 | - | self.languageCombo = QComboBox() | |
128 | - | self.languageCombo.addItem(self.tr("None"), userData="") | |
129 | - | for lang in languages: | |
130 | - | langtag = lang | |
131 | - | lang = languages[lang] | |
132 | - | langname = lang[0] | |
133 | - | self.languageCombo.addItem(tr_lang()(langname), userData=langtag) | |
134 | - | self.languageCombo.currentIndexChanged.connect(self.comboChanged) | |
135 | - | layout.addWidget(self.languageCombo) | |
136 | - | ||
137 | - | layout.addSpacing(15) | |
138 | - | ||
139 | - | warnText = QLabel(self) | |
140 | - | warnText.setText(self.tr("Note that you should only translate into \ | |
141 | - | native language or to a language you are extremely familiar with, to avoid \ | |
142 | - | weird or nonsensical translations.")) | |
143 | - | warnText.setWordWrap(True) | |
144 | - | layout.addWidget(warnText) | |
145 | - | ||
146 | - | # TODO: Add information about the selected language, to redirect users | |
147 | - | # to translation teams, resources, etc | |
148 | - | ||
149 | - | # TODO: Allow users to select an unlisted language, by providing | |
150 | - | # language codes. | |
120 | + | self.lang = LangSettingsWidget() | |
121 | + | layout.addWidget(self.lang) | |
122 | + | self.lang.changed.connect(self.langChanged) | |
151 | 123 | ||
152 | 124 | self.setLayout(layout) | |
153 | 125 | ||
154 | 126 | self.langEdit = QLineEdit() | |
155 | 127 | self.registerField("lang*", self.langEdit) | |
156 | 128 | ||
157 | - | def comboChanged(self, index): | |
158 | - | self.langEdit.setText(self.languageCombo.itemData(index)) | |
129 | + | def langChanged(self, lang): | |
130 | + | self.langEdit.setText(lang) | |
159 | 131 | ||
160 | 132 | class PageProjectSelection(QWizardPage): | |
161 | 133 | def __init__(self, parent): |