Cropster / ember-l10n

A GNU gettext based localization workflow for Ember
MIT License
15 stars 7 forks source link

Sync command doesn't seems to work #71

Closed ctjhoa closed 4 years ago

ctjhoa commented 4 years ago

Hi,

I not 100% sure to fully understand ember l10n:sync command, so let me explain what I've try.

Using a new ember app:

Here is my template

template/application.hbs:

{{!-- The following component displays Ember's default welcome message. --}}
{{!-- Feel free to remove this! --}}

{{t "simple text"}}

{{outlet}}

I generate po files using ember l10n:extract

translations/en.po:

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\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"

#: app/templates/application.hbs:4:0
msgid "simple text"
msgstr "simple text"

I change msgid "simple text" to msgid "some text" in translations/en.po

I expect ember l10n:sync to modify my template/application.hbs to

{{t "some text"}}

However it does nothing

% ember l10n:sync

========================================
PARSING SOURCE FILES
========================================

Checked ./app/app.js... unchanged ✔
Checked ./app/controllers/application.js... unchanged ✔
Checked ./app/router.js... unchanged ✔
Checked ./app/services/l10n.js... unchanged ✔
Checked ./app/templates/application.hbs... unchanged ✔

No files updated ✔

FINISHED ✔

Is it expected?

mydea commented 4 years ago

You need to leave the msgid and change the msgstr. Then, it should update your source files, replacing all occurrences of the msgid with the new msgstr.