Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Prepare project to use Zanata for translations #362

Merged
merged 38 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fc58cca
Change name of .pot file to match translation files
KurzedMetal Jul 5, 2019
094e251
Update PO files to latest version of the code
KurzedMetal Jul 5, 2019
0479a22
Create configuration file for Zanata service
KurzedMetal Jul 5, 2019
2e60322
Remove obsolete strings in PO files
KurzedMetal Jul 5, 2019
801ef6d
Add setup.py commands for Zanata service
KurzedMetal Jul 6, 2019
e26809b
Add '.zanata-cache' to .gitignore
KurzedMetal Jul 6, 2019
4e712df
Added reference to Zanata in README and CONTRIBUTING
KurzedMetal Jul 6, 2019
4d11389
Add command to push translations to Zanata too
KurzedMetal Jul 6, 2019
36ed5e5
Add Transifex config file after `tx init`
KurzedMetal Jul 10, 2019
996459f
Add transifex-client to requirements.txt
KurzedMetal Jul 10, 2019
4918e00
Remove few Russian translations to avoid Transifex import errors
KurzedMetal Jul 10, 2019
63af7c7
Make Zanata merge translations when pushing
KurzedMetal Jul 10, 2019
e719f95
Update setup.py Command descriptions
KurzedMetal Jul 10, 2019
3628091
Rename setup.py translation Commands
KurzedMetal Jul 10, 2019
c00d6f8
Change translation service from Zanta to Transifex
KurzedMetal Jul 10, 2019
092b43e
Update Translation section in CONTRIBUTING.md
KurzedMetal Jul 10, 2019
0fa421d
Fix translation_pull to use the correct "mode"
KurzedMetal Jul 10, 2019
5243d15
Add --force to Transifex pull/push
KurzedMetal Jul 10, 2019
6de59c0
Fix "exup_messages" when calling it from command line
KurzedMetal Jul 11, 2019
8cfcbd8
Create small commands from ExtractUpdateMessages
KurzedMetal Jul 11, 2019
feea1c5
Simplify calling other Commands with new defaults
KurzedMetal Jul 11, 2019
1496d6b
Force a compile_catalog after pulling translation from Transifex
KurzedMetal Jul 11, 2019
17d82e7
Add log function in setup.py for showing extra info
KurzedMetal Jul 11, 2019
9d7a889
Make a small change for readability
KurzedMetal Jul 11, 2019
6e9aed8
Remove some untranslatable strings
KurzedMetal Jul 11, 2019
5781ffe
Avoid passing to gettext an string that require no translation
KurzedMetal Jul 11, 2019
39be75b
Make locale 'en' available even if .po for english doesn't exist
KurzedMetal Jul 11, 2019
2a05e34
Delete obsolete 'en' locale .po file
KurzedMetal Jul 11, 2019
680cc77
Split "About" text into smaller strings
KurzedMetal Jul 11, 2019
e54e6eb
Avoid translation of the MIT license
KurzedMetal Jul 11, 2019
92e7d32
Add a translatable summary of what "MIT" means for the user
KurzedMetal Jul 11, 2019
f3f1e1e
Fix typo
KurzedMetal Jul 11, 2019
aed9767
Remove references to Zanata
KurzedMetal Jul 12, 2019
9a64271
Make a few more strings translatable
KurzedMetal Jul 12, 2019
5ff70c3
Avoid having to maintain extra translation strings
KurzedMetal Jul 12, 2019
7c46690
Change % in translatable HTML string to HTML entity %
KurzedMetal Jul 12, 2019
7e29c6b
Avoids issue when having empty english `.po` is still around
KurzedMetal Jul 15, 2019
7361bd7
Fix typo
KurzedMetal Jul 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[main]
host = https://www.transifex.com

[cdda-game-launcher-project.cddagl-pot]
file_filter = cddagl/locale/<lang>/LC_MESSAGES/cddagl.po
minimum_perc = 0
source_file = cddagl/locale/cddagl.pot
source_lang = en
type = PO

11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ requests](#pull-requests), but please respect the following restrictions:
respect the opinions of others.


<a name="translations"></a>
## Translations

CDDA Game Launcher translations are hosted in Transifex. Transifex is a service
with a straightforward web interface to let contributors help with untranslated text.

Anyone is welcome to create or improve translations directly from
[our project's page in Transifex](https://www.transifex.com/cdda-game-launcher/cdda-game-launcher-project/)
after a simple registration process.


<a name="bugs"></a>
## Bug reports

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Anyone and everyone is welcome to contribute. Please take a moment to review the
* [Bug reports](CONTRIBUTING.md#bugs)
* [Feature requests](CONTRIBUTING.md#features)
* [Pull requests](CONTRIBUTING.md#pull-requests)
* [Translation contributions](CONTRIBUTING.md#translations)

## Code of conduct

Expand Down
4 changes: 2 additions & 2 deletions cddagl/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def sizeof_fmt(num, suffix=None):
for unit in ['', _('Ki'), _('Mi'), _('Gi'), _('Ti'), _('Pi'), _('Ei'),
_('Zi')]:
if abs(num) < 1024.0:
return _("%3.1f %s%s") % (num, unit, suffix)
return "%3.1f %s%s" % (num, unit, suffix)
num /= 1024.0
return _("%.1f %s%s") % (num, _('Yi'), suffix)
return "%.1f %s%s" % (num, _('Yi'), suffix)

def delete_path(path):
''' Move directory or file in the recycle bin (or permanently delete it
Expand Down
10 changes: 6 additions & 4 deletions cddagl/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ def proxy_ngettext(*args, **kwargs):

def get_available_locales(locale_dir):
"""Return a list of available locales in the specified directory."""
available_locales = []
available_locales = {'en'}
if os.path.isdir(locale_dir):
entries = os.scandir(locale_dir)
for entry in entries:
if entry.is_dir():
available_locales.append(entry.name)
available_locales.add(entry.name)

available_locales.sort(key=lambda x: 0 if x == 'en' else 1)
return available_locales
return sorted(available_locales, key=lambda x: 0 if x == 'en' else 1)


def load_gettext_no_locale():
Expand All @@ -57,6 +56,9 @@ def load_gettext_locale(locale_dir, locale, domain='cddagl'):

Fallback to default untranslated strings if locale file is not found.
"""
if locale == 'en':
return load_gettext_no_locale()

try:
translation = gettext.translation(domain, localedir=locale_dir, languages=[locale])
except FileNotFoundError as err:
Expand Down
Loading