Merge pull request #80 from MightyCreak/fix-translations

Add POTFILES.in and update translations
This commit is contained in:
Creak 2020-12-08 13:39:37 -05:00 committed by GitHub
commit 524b5c4fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 9484 additions and 9481 deletions

View File

@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed AppID to io.github.mightycreak.Diffuse (as explained in
[Flatpak documentation](https://docs.flatpak.org/en/latest/conventions.html#application-ids))
- Renamed `translations/` to `po/`
- Now uses POTFILES.in to list the files to translate
- Translation strings are no longer sorted alphabetically, this will help when there will be
several files in POTFILES.in
- Updated the documentation and script in the `po/` directory
### Fixed

2
po/POTFILES.in Normal file
View File

@ -0,0 +1,2 @@
# List of source files which contain translatable strings.
src/usr/bin/diffuse.py.in

View File

@ -9,23 +9,30 @@ The example commands below show how to create and manage the Japanese
translations. Replace all instances of "ja" with the code for the desired
language.
Creating a new translation
--------------------------
Create PO template
------------------
1. Create a .pot file for Diffuse:
To create or update the PO template (`po/diffuse.pot`), use this command at the
repo root:
$ xgettext -s -o diffuse.pot -L Python ../src/usr/bin/diffuse
xgettext -o po/diffuse.pot -f po/POTFILES.in
2. Create a .po file for the translation:
Create a new translation
------------------------
$ msginit -l ja -o ja.po -i diffuse.pot
To create a new translation file, you'll need a PO template. If not already
created, refer to previous section "Create PO template".
3. Manually complete in the translations in the .po file:
1. Create a .po file for the translation:
$ vi ja.po
msginit -l ja -o ja.po -i diffuse.pot
Updating an existing translation
--------------------------------
2. Manually complete in the translations in the .po file:
vim ja.po
Update a translation
--------------------
Use `update-translations.py` to update one or more PO files.

1454
po/cs.po

File diff suppressed because it is too large Load Diff

1458
po/de.po

File diff suppressed because it is too large Load Diff

1470
po/es.po

File diff suppressed because it is too large Load Diff

1454
po/it.po

File diff suppressed because it is too large Load Diff

1454
po/ja.po

File diff suppressed because it is too large Load Diff

1454
po/ko.po

File diff suppressed because it is too large Load Diff

1444
po/pl.po

File diff suppressed because it is too large Load Diff

1454
po/pt.po

File diff suppressed because it is too large Load Diff

1458
po/ru.po

File diff suppressed because it is too large Load Diff

1454
po/sv.po

File diff suppressed because it is too large Load Diff

1454
po/th.po

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,6 @@ import subprocess
import shutil
import tempfile
def generate_pot_file():
subprocess.run(["xgettext", "-s", "-o", "diffuse.pot", "-L", "Python", "../src/usr/bin/diffuse"])
def check_translation(filename):
subprocess.run(["msgfmt", "-c", "-v", filename])
@ -61,8 +58,6 @@ parser.add_argument('po_files', metavar='filename.po', nargs='+',
help='the translation file')
parser.add_argument('-c', '--check-only', action='store_true',
help='check the PO files')
parser.add_argument('--no-pot-generation', action='store_true',
help='don\'t generate the POT file')
# Parse command-line arguments
args = parser.parse_args()
@ -77,11 +72,6 @@ if args.check_only:
check_translation(file)
exit(0)
if not args.no_pot_generation:
# Generate diffuse.pot file
print("Generate 'diffuse.pot'.")
generate_pot_file()
# Create temporary working directory
tmpdir = tempfile.mkdtemp()
try:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff