Edgewall Software
Modify

Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#12976 closed enhancement (fixed)

Impossible to translate trac

Reported by: Klumbumbus Owned by:
Priority: normal Milestone: 1.0.17
Component: i18n Version:
Severity: normal Keywords:
Cc: Dirk Stöcker, Steffen Hoffmann Branch:
Release Notes:

Added script to contrib for merging translation catalogs: merge_catalog.py​.

API Changes:
Internal Changes:

Description

I requested to join the german translation team at https://www.transifex.com/cboos/trac/ but received no reaction since months. (I talked to Dirk Stöcker but it seems he has no permission to approve my request.)

Attachments (6)

tractranslation.png (44.8 KB ) - added by Klumbumbus 7 years ago.
trunk-pofiles-de.zip (80.0 KB ) - added by Jun Omae 7 years ago.
merge_catalog.py (2.3 KB ) - added by Jun Omae 7 years ago.
trunk-pofiles-de_v2.zip (78.7 KB ) - added by Jun Omae 7 years ago.
tracini_compare.diff (12.7 KB ) - added by Klumbumbus 7 years ago.
merge_catalog-v2.py (3.9 KB ) - added by Jun Omae 7 years ago.

Download all attachments as: .zip

Change History (31)

comment:1 by Ryan J Ollos, 7 years ago

Milestone: not applicable
Resolution: fixed
Status: newclosed

Accepted.

comment:2 by Klumbumbus, 7 years ago

Thanks. Will future requests be approved faster? There shouldn't be such a big barrier for new translators.

comment:3 by Ryan J Ollos, 7 years ago

I haven't been receiving notifications from Transifex. I've added a check of the site to my weekly review.

comment:4 by Klumbumbus, 7 years ago

OK

comment:5 by Klumbumbus, 7 years ago

At https://josm.openstreetmap.de/ we use trac 1.2.2

Which one do we need to translate at transifex, 1.2-stable or trunk?

by Klumbumbus, 7 years ago

Attachment: tractranslation.png added

comment:6 by Jun Omae, 7 years ago

1.2-stable. 1.2-stable is not trunk (1.3.x).

See wiki:TracL10N#UsingTransifex and wiki:TracL10N/Transifex.

Last edited 7 years ago by Jun Omae (previous) (diff)

comment:7 by Klumbumbus, 7 years ago

I noticed that there are untranslated strings in e.g. trunk-messages.pot which are already translated in 1.2-stable-messages.pot Could you please copy these identical translated strings to the trunk branch so no double work is required by translators and they can concentrate on the changed/new strings? Else if a new version of trac will be released we will end up with a half translated trac again while the strings are actually translated.

comment:8 by Jun Omae, 7 years ago

You cloud easily copy using trasifex-client rather than transifex web interface, see wiki:TracL10N/Transifex#SynchronizationwithTransifex.

comment:9 by Klumbumbus, 7 years ago

I'm not the translation team coordinator and the process written on wiki:TracL10N/Transifex#SynchronizationwithTransifex is too complex and risky for me.

by Jun Omae, 7 years ago

Attachment: trunk-pofiles-de.zip added

by Jun Omae, 7 years ago

Attachment: merge_catalog.py added

comment:10 by Jun Omae, 7 years ago

I wrote merge_catalog.py which merges translated strings from the given *.po file.

Results: trunk-pofiles-de.zip.

Please check the *.po files and upload to Transifex if no issues.

$ cd branches/1.2-stable
$ tx pull -l de -f
Pulling translations for resource trac.1_2-stable-messages-js-pot (source: trac/locale/messages-js.pot)
 -> de: trac/locale/de/LC_MESSAGES/messages-js.po
Pulling translations for resource trac.1_2-stable-messages-pot (source: trac/locale/messages.pot)
 -> de: trac/locale/de/LC_MESSAGES/messages.po
Pulling translations for resource trac.1_2-stable-tracini-pot (source: trac/locale/tracini.pot)
 -> de: trac/locale/de/LC_MESSAGES/tracini.po
Done.
$ cd ../../trunk
$ for i in messages messages-js tracini; do
>   PYTHONPATH=. ./merge_catalog.py $i ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/$i.po
> done
Merged 254 messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/messages.po and updated trac/locale/de/LC_MESSAGES/messages.po
Merged 11 messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/messages-js.po and updated trac/locale/de/LC_MESSAGES/messages-js.po
Merged 64 messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/tracini.po and updated trac/locale/de/LC_MESSAGES/tracini.po

comment:11 by Klumbumbus, 7 years ago

When I upload the files does transifex keep already translated strings untouched or will they be overwritten by the strings in the files (which are older for some)?

E.g. trunk - trac/locale/messages-js.pot is already at 100%. If I would upload your generated file would this change anything?

by Jun Omae, 7 years ago

Attachment: trunk-pofiles-de_v2.zip added

in reply to:  11 ; comment:12 by Jun Omae, 7 years ago

Replying to Klumbumbus:

When I upload the files does transifex keep already translated strings untouched or will they be overwritten by the strings in the files (which are older for some)?

E.g. trunk - trac/locale/messages-js.pot is already at 100%. If I would upload your generated file would this change anything?

Sorry, I missed pulling *.po files for trunk from Transifex. Please use trunk-pofiles-de_v2.zip.

  • messages.po: merged 90 strings from 1_2-stable-messages-pot (de)
  • messages-js.po: merged no strings from 1_2-stable-messages-js-pot (de)
  • tracini.po: merged 4 strings from 1_2-stable-tracini-pot (de)
$ tx pull -l de -f
Pulling translations for resource trac.trunk-messages-js-pot (source: trac/locale/messages-js.pot)
 -> de: trac/locale/de/LC_MESSAGES/messages-js.po
Pulling translations for resource trac.trunk-messages-pot (source: trac/locale/messages.pot)
 -> de: trac/locale/de/LC_MESSAGES/messages.po
Pulling translations for resource trac.trunk-tracini-pot (source: trac/locale/tracini.pot)
 -> de: trac/locale/de/LC_MESSAGES/tracini.po
Done.
$ make stats-de
trac/locale/de/LC_MESSAGES/messages.po: 1328 translated messages, 95 untranslated messages.
trac/locale/de/LC_MESSAGES/messages-js.po: 63 translated messages.
trac/locale/de/LC_MESSAGES/tracini.po: 80 translated messages, 116 untranslated messages.
$ for i in messages messages-js tracini; do
>  PYTHONPATH=. ./merge_catalog.py $i ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/$i.po
done
Merged 90 messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/messages.po and updated trac/locale/de/LC_MESSAGES/messages.po
Merged no messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/messages-js.po
Merged 4 messages from ../branches/1.2-stable/trac/locale/de/LC_MESSAGES/tracini.po and updated trac/locale/de/LC_MESSAGES/tracini.po
$ make stats-de
trac/locale/de/LC_MESSAGES/messages.po: 1418 translated messages, 5 untranslated messages.
trac/locale/de/LC_MESSAGES/messages-js.po: 63 translated messages.
trac/locale/de/LC_MESSAGES/tracini.po: 84 translated messages, 112 untranslated messages.
Last edited 7 years ago by Jun Omae (previous) (diff)

in reply to:  12 comment:13 by Jun Omae, 7 years ago

Replying to Jun Omae:

Replying to Klumbumbus:

When I upload the files does transifex keep already translated strings untouched or will they be overwritten by the strings in the files (which are older for some)?

All strings would be replaced with strings in uploaded *.po file even if translated/untranslated.

by Klumbumbus, 7 years ago

Attachment: tracini_compare.diff added

comment:14 by Klumbumbus, 7 years ago

Thanks, that looks better. Could you please create the files again without line wrapping in the translated strings? As the po files you can download from transifex don't use line wrapping in the translated strings this makes the diff file confusing. See attachment:tracini_compare.diff

in reply to:  14 comment:15 by Jun Omae, 7 years ago

Replying to Klumbumbus:

Could you please create the files again without line wrapping in the translated strings?

No. merge_catalog.py script uses Babel library which automatically wraps with 76 characters.

Try to upload the *.po files to Transifex before you modify the *.po files. Also, you could use the merge_catalog.py script.

in reply to:  10 ; comment:16 by Ryan J Ollos, 7 years ago

Replying to Jun Omae:

I wrote merge_catalog.py which merges translated strings from the given *.po file.

That looks nice. Do you plan to put it in contrib?

That might make it unnecessary to combine the messages from all the branches in a single pot file.

I found it was necessary to compile the catalogs in the target. The get_negotiated_locale function will return None unless catalogs have been compiled, since it calls get_available_locales.

$for i in messages messages-js tracini;
do PYTHONPATH=. ./merge_catalog.py $i ../trac-1.2-stable/trac/locale/de/LC_MESSAGES/$i.po;
done
Traceback (most recent call last):
  File "./merge_catalog.py", line 79, in <module>
    sys.exit(main(domain, source_file) or 0)
  File "./merge_catalog.py", line 37, in main
    target = _open_pofile(target_file)
  File "./merge_catalog.py", line 23, in _open_pofile
    with open(filename, 'rb') as f:
IOError: [Errno 2] No such file or directory: 'trac/locale/None/LC_MESSAGES/messages.po'
[...]

Currently, the following steps work from clean working copies:

$ cd trac-1.2-stable
$ tx pull -l de -f
$ cd ../trac-trunk
$ tx pull -l de -f
$ make compile-de
$ for i in messages messages-js tracini; 
> do PYTHONPATH=. ./merge_catalog.py $i ../trac-1.2-stable/trac/locale/de/LC_MESSAGES/$i.po;
done

by Jun Omae, 7 years ago

Attachment: merge_catalog-v2.py added

in reply to:  16 ; comment:17 by Jun Omae, 7 years ago

Replying to Ryan J Ollos:

Replying to Jun Omae:

I wrote merge_catalog.py which merges translated strings from the given *.po file.

That looks nice. Do you plan to put it in contrib?

Okay. Added copyright comments, merge_catalog-v2.py. I'll put it to 1.2-stable/contrib and trunk.

I found it was necessary to compile the catalogs in the target. The get_negotiated_locale function will return None unless catalogs have been compiled, since it calls get_available_locales.

Thanks for the testing. Fixed it to check *.po files rather than *.mo files. It would be unnecessary to compile the catalogs.

comment:18 by Klumbumbus, 7 years ago

I just uploaded the files. This moved 94 strings to trunk. Lots of saved translation work! Thanks for the support.

comment:19 by Ryan J Ollos, 7 years ago

Cc: Dirk Stöcker Steffen Hoffmann added; Dirk Stöcker Steffen Hoffmann removed
Milestone: not applicable1.0.17
Release Notes: modified (diff)
Resolution: fixed
Status: closedreopened
Type: defectenhancement

in reply to:  17 comment:20 by Ryan J Ollos, 6 years ago

Replying to Jun Omae:

Thanks for the testing. Fixed it to check *.po files rather than *.mo files. It would be unnecessary to compile the catalogs.

Looks good to commit. Thanks! I will probably use for #13026.

comment:21 by Jun Omae, 6 years ago

Committed contrib/merge_catalog.py in [16677-16679].

comment:22 by Ryan J Ollos, 6 years ago

Resolution: fixed
Status: reopenedclosed

comment:23 by Ryan J Ollos, 5 years ago

Proposed changes for trunk to use argparse in merge_catalog.py: [75b976e56/rjollos.git].

comment:24 by Ryan J Ollos, 5 years ago

comment:25 by Ryan J Ollos, 5 years ago

Changes committed in r16999.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.