oliver / gedit-file-search

Gedit plugin to search a text in all files in a directory
https://oliver.github.io/gedit-file-search/
43 stars 11 forks source link

Make gedit-file-search translatable #3

Closed jpfleury closed 13 years ago

jpfleury commented 13 years ago

I would like to help making this plugin translatable. I'll try to provide patches.

jpfleury commented 13 years ago

First patch: Translation in French of "file-search.gedit-plugin

jpfleury commented 13 years ago

About file-search.glade

About file-search.glade, strings are already flagged as translatable with translatable attribute. Example:

<property name="label" translatable="yes">Only these file types:</property>

but we must extract these strings to create a template. The new target make pot in the Makefile achieves this, by generating the file file-search.pot in the new folder file-search-lang.

Then, to make a translation, we just have to create a .po file by copying this template and paste it in file-search-lang/LANG/LC_MESSAGES/file-search.po (replace LANG with the lang code), for example:

file-search-lang/fr/LC_MESSAGES/file-search.po

If the template was changed, .po files can be updated with the target make po.

To make a translation usable in gedit, each .po file must be compiled into a .mo binary file. The new target make mo is used for this.

All these steps can be performed with the single target make tgz, that depends on both po and mo targets.

The following patch adds all needed stuff in Makefile:

gedit-file-search: patch to make Makefile manage translation

The following file is the translation in French (so the file file-search-lang/fr/LC_MESSAGES/file-search.po):

gedit-file-search: translation in French

To ignore .mo binary files with git, apply this patch:

gedit-file-search: patch to ignore .mo binary files with git

About file-search.py

The last modifications needed are about file-search.py:

The following patch solves these 3 points:

gedit-file-search: patch to make the plugin translatable

oliver commented 13 years ago

Wow, nice work - thanks a lot!

It would be good if we could get this integrated on the new "subdir" branch (https://github.com/oliver/gedit-file-search/tree/subdir) which already puts all files into a new subdirectory. I'll see to get the subdir stuff finished and will then merge the translation code.

jpfleury commented 13 years ago

OK. Surely patches will need some adjustments. Say me when I can use https://github.com/oliver/gedit-file-search/tree/subdir to modify them.

In the meantime, I'll modify a little bit my patch for file-search.py, because it interferes with gedit translation.

jpfleury commented 13 years ago

Problem solved. The patch has been updated.

oliver commented 13 years ago

The subdir branch has been merged into master branch now, so you can do any adjustments based on master.

jpfleury commented 13 years ago

Cool. I test my patches right now.

oliver commented 13 years ago

Sorry, I had forgotten to adjust the Makefile for the subdirectory move. It's updated now - can you take that into account yet?

jpfleury commented 13 years ago

No problem.

jpfleury commented 13 years ago

All patches have been updated:

oliver commented 13 years ago

Ok, pushed to i18n branch now (https://github.com/oliver/gedit-file-search/tree/i18n) - thanks a lot!

Btw. should the .pot file be checked in as well?

jpfleury commented 13 years ago

Thanks!

Btw. should the .pot file be checked in as well?

I don't think it should be versioned, because it's automatically generated with make pot.