question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cli/extract: update source translations

See original GitHub issue

This is obviously only relevant when using messages with custom IDs.

Right now if we extract messages and then decide to update them (in source code) and run extract again - it won’t update the messages in catalog. It will leave initial strings and there’d be no way to update them other than manually edit the catalog.

I think it shouldn’t be like that and we should update source catalog with updated messages in this case.

We can change this string:

translation: prevCatalog[key].translation,

to

translation: config.sourceLocale === locale ? nextCatalog[key].defaults : prevCatalog[key].translation,

And this leads to another issue 😃 (I wrote about it here) - when using minimal format with custom IDs, it extracts as 'message.id': 'message.id' instead of 'message.id': 'default message' This can be fixed here, changing:

translation: config.sourceLocale === locale ? key : "",

to

translation: config.sourceLocale === locale ? message.defaults : "",

What do you think?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
tricoder42commented, Jul 4, 2018

Fixed and released in v2.2.0. Thanks to all involved!

1reaction
tricoder42commented, Jun 30, 2018

Alright, just to narrow the problem down. This is related only to message catalog for sourceLocale in minimal format. I think --overwrite makes more sense than --update-defaults.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference - CLI (@lingui/cli) — LinguiJS documentation
@lingui/cli manages locales, extracts messages from source files into message catalogs and compiles ... Update translations for sourceLocale from source.
Read more >
Work with translation files - Angular
Complete the following steps to create and update translation files for your project. Extract the source language file. Optionally, change the location, ...
Read more >
POEdit: Can't update translations from Source Code
I am using POEdit for translations in a web application. However, when I start POEdit I can't find any sources when I run...
Read more >
Files Management | Crowdin Documentation
To download translations for the chosen file, select the required languages, and click Build & Download. Updating Source Files. In case you have...
Read more >
Download languages to use offline - Google Translate Help
Update or remove languages · Connect to Wi-Fi. · On your Android phone or tablet, open the Translate app Translate app . ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found