marcglasberg / i18n_extension

Flutter package: Easy and powerful internationalization using Dart extensions.
Other
294 stars 64 forks source link

How to add translator comments ? #95

Open jeduden opened 3 years ago

jeduden commented 3 years ago

I was wondering how I can add comments for translators ? I am looking for a feature similar to what xgettext has. It picks up comments preceding the gettext string with the --add-comments option.

bauerj commented 3 years ago

Just to make sure we're talking about the same thing here:

You want comments like

choices = [
    // translators: Like a can of soda, not like "Yes we can".
    "can".i18n,
    "bottle".i18n
];

To end up in your template when you run getstrings?

If so, this is not yet possible, although it seems like a useful feature and would be easy enough to implement.

jeduden commented 3 years ago

Indeed. I would expect resulting pot file to contain:

#. Like a can of soda, not like "Yes we can".
msgctxt "choices.dart:12"
msgid "can"
msgstr ""