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

Parser ignores translations within string interpolation #96

Closed dfherr closed 1 year ago

dfherr commented 1 year ago

Hi there,

first up, i'm still running an older version, but I couldn't see anything related to this changed in the parser.

The xgettext rb parser is not pickung up translations within string interpolation:

"#{_('string interpolation')}"

Since this restriction isn't really mentioned anywhere I assume this is a bug?

kou commented 1 year ago

Could you provide a way to reproduce this?

I couldn't reproduce this:

$ cat /tmp/a.rb
"#{_('string interpolation')}"
$ rxgettext /tmp/a.rb
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-07 09:53+0900\n"
"PO-Revision-Date: 2023-07-07 09:53+0900\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

#: /tmp/a.rb:1
msgid "string interpolation"
msgstr ""
dfherr commented 1 year ago

Sorry I bothered you. This was caused by our very outdated version. Even though I looked at the changes/history of the ruby parser and didn't see a fix, the current version correctly picks it up!

Thanks for providing the minimal example command. I was piping it through our whole stack and the in-code calls and didn't know I can run it like this from command line to test :)