ruby-gettext / gettext

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.
https://ruby-gettext.github.io/
68 stars 28 forks source link

How is the header output customized? #83

Closed zeke closed 3 years ago

zeke commented 3 years ago

Hello there, gettext maintainers! 👋🏼

I'm new to the gettext world, and to using this gem. Running rake gettext:find produces a boilerplate header that looks like this:

# 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"
"Language-Team: English\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"

How can I configure my Ruby project so that values like FIRST AUTHOR and EMAIL@ADDRESS are filled with real values when I run the rake task? I didn't see any documentation about how this works, but would be happy to contribute a pull request with docs for that, once I figure this out.

Thanks!

cc @mjacobus @bigzoo

kou commented 3 years ago

Who does define gettext:find?

zeke commented 3 years ago

Apologies @kou, I meant the rake gettext:po:update task.

(It is aliased as rake gettext:find in the gettext_i18n_rails gem.)

kou commented 3 years ago

Thanks. Could you show the name of the file that contains the content?

kou commented 3 years ago

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.

zeke commented 3 years ago

Thanks for the explanation, @kou :sparkles:

I've opened a followup issue on that repo: https://github.com/grosser/gettext_i18n_rails/issues/184