https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39564
Julian Maurice <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #180642|0 |1 is obsolete| | --- Comment #2 from Julian Maurice <[email protected]> --- Created attachment 180643 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180643&action=edit Bug 39564: Enable runtime translations for plugins (Koha::I18N) This solution uses gettext's textdomain feature to allow plugins to use Koha::I18N for their own translations. Basically we have one textdomain per plugin and we bind the directory where a plugin store its translations (.mo files) to its textdomain. Plugins have to specify the textdomain like this: __d('MyPlugin', 'string to translate') or, if within a template: [% I18N.td('MyPlugin', 'string to translate') %] This patches adds several functions to Koha::I18N: __d, __dn, __dp, __dnp, __dx, __dnx, __dpx, and __dnpx and their template equivalents in Koha::Template::Plugin::I18N It also moves some code for string extraction from gulpfile.js to misc/translator/xgettext-perl and misc/translator/xgettext-js for easier use by plugins authors. (Note that, even if there is a misc/translator/xgettext-js script, this patch does not add support for JS translations in plugins) By default a plugin named Koha::Plugin::Foo will have a textdomain 'Koha-Plugin-Foo'. It can be changed by overriding method locale_textdomain. By default the directory bound to the textdomain will be Koha/Plugin/Foo/locale. It can be changed by overriding method locale_dir. This directory should contain one subdirectory for each language, and each language subdirectory should contain an LC_MESSAGES subdirectory which should contain a <textdomain>.mo file. It should look like this: Koha/ Plugin/ Foo/ locale/ fr_FR/ LC_MESSAGES/ Koha-Plugin-Foo.mo de_DE/ LC_MESSAGES/ Koha-Plugin-Foo.mo ... -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
