grosser / gettext_i18n_rails

Rails: FastGettext, I18n integration -- simple, threadsafe and fast!
MIT License
268 stars 91 forks source link

supporting custom headers in generated PO files #184

Open zeke opened 3 years ago

zeke commented 3 years ago

Hi @grosser ๐Ÿ‘‹๐Ÿผ

I'd like to be able to customize the header output that's generated in PO files when running rake gettext:find. Currently there are some placeholder values like FIRST AUTHOR, COPYRIGHT HOLDER, FULL_NAME, etc:

# English translations for foo package.
# Copyright (C) 2021 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the foo package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
msgid ""
msgstr ""
"Project-Id-Version: github 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-01-22 21:21-0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"\n"

I opened an issue on the ruby-gettext/gettext repo, where @kou pointed out that:

You need to add --translator, --translator-name=XXX, --translator-email=YYY options to msginit. It seems that https://github.com/grosser/gettext_i18n_rails/blob/master/lib/gettext_i18n_rails/tasks.rb provides APIs to add options to msgmerge, msgcat and xgettext but doesn't provide an API to add options to msginit.

Is this something you'd be open to adding support for in gettext_i18n_rails? If so, I'd be happy to help on it but might need a little guidance along the way.

cc @bigzoo @mjacbous @southgate

grosser commented 3 years ago

PR welcome ... should be easy to do by either passing through some options or env-vars ... just make sure it's not required :)