transloco-keys-manager icon indicating copy to clipboard operation
transloco-keys-manager copied to clipboard

Bug: "extract --sort" not working when output is set to POT

Open votdev opened this issue 3 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is this a regression?

No

Current behavior

Running transloco-keys-manager extract --sort does not sort the keys in the output file.

The output looks like this for previously started project:

msgid ""
msgstr ""
"mime-version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Toggle navigation"
msgstr ""

msgid "Help"
msgstr ""

msgid "Dashboard"
msgstr ""

msgid "OK"
msgstr ""

msgid "Cancel"
msgstr ""

msgid "Yes"
msgstr ""

msgid "No"
msgstr ""

msgid "Users"
msgstr ""

msgid "Do you really want to sign out?"
msgstr ""

Expected behavior

The keys/msgid should be sorted, e.g. like ngx-translate-extract is doing it.

Please provide a link to a minimal reproduction of the bug

https://github.com/aquarist-labs/s3gw-ui

Transloco Config

module.exports = {
  rootTranslationsPath: 'src/assets/i18n/',
  langs: ['en_US'],
  keysManager: {
    fileFormat: 'pot',
    marker: 'TEXT',
    defaultValue: ''
  }
};

Debug Logs

No response

Please provide the environment you discovered this bug in

Transloco: 4.1.0
Transloco Keys Manager: 3.4.1
Angular: 13.3.11
Node: v16.15.1
Package Manager: 
OS: Ubuntu

Additional context

No response

I would like to make a pull request for this bug

No

votdev avatar Jun 20 '22 14:06 votdev

@votdev Please provide the expected result and the actual result. I don't understand the output you pasted.

shaharkazaz avatar Jul 19 '22 10:07 shaharkazaz

@votdev Please provide the expected result and the actual result. I don't understand the output you pasted.

Sure.

The current output looks like this (taken from above):

msgid ""
msgstr ""
"mime-version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Toggle navigation"
msgstr ""

msgid "Help"
msgstr ""

msgid "Dashboard"
msgstr ""

msgid "OK"
msgstr ""

msgid "Cancel"
msgstr ""

The expected result is this when using the --sort option.

msgid ""
msgstr ""
"mime-version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Cancel"
msgstr ""

msgid "Dashboard"
msgstr ""

msgid "Help"
msgstr ""

msgid "OK"
msgstr ""

msgid "Toggle navigation"
msgstr ""

votdev avatar Jul 24 '22 18:07 votdev

@votdev so if I understand correctly it seems that the issue is occurring when using POT output format, can you confirm?

shaharkazaz avatar Aug 19 '22 06:08 shaharkazaz

@votdev so if I understand correctly it seems that the issue is occurring when using POT output format, can you confirm?

Yes

votdev avatar Aug 19 '22 06:08 votdev