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.

i18n._ does not format values in production build

See original GitHub issue

Describe the bug When using i18n._ with the second argument “values” those values are not inserted into the string in production build, but they are inserted into the string in development when running npm run start.

To Reproduce I have created a sample repository that can be used to reproduce the problem:

https://github.com/nmoinvaz/lingui-values-bug

Relevant code file: https://github.com/nmoinvaz/lingui-values-bug/blob/main/src/App.js

  • npm install
  • npm run start

In development the strings are properly replaced:

image

  • npm build
  • serve -s build

In production the strings are not properly replaced:

image

Expected behavior The values object should be inserted into the string. For example {a} should be replaced with 1.

Additional context

  • ling-ui version 3.9.0
  • Create React App

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
nmoinvazcommented, Jun 16, 2021

Figured it out, works like a charm in development and production builds! Thank you.

2reactions
semoalcommented, Jun 14, 2021

Polish some details and I’ll release a new version with this new tool

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular i18n translation in production not working
angular i18n doesn't work with aot. try to build like this make sure to turn aot off: ... i18nFormat: the format of the...
Read more >
Develop with formatjs | Format.JS
Issue when we try to format a sentence but some of the placeholder values are malformed, e.g passing in a string for a...
Read more >
React i18n: A step-by-step guide to React-intl - Lokalise Blog
React-intl is a part of FormatJS and is the best React i18n library. Localizing Text, Numbers, and DateTime can be handled easily with...
Read more >
How to properly internationalize a React application using ...
Based on how long i18next already is available open source, there is no real i18n case that could not be solved with i18next....
Read more >
Optimization - Vue I18n - Intlify
IF CSP is enabled, vue-i18n.esm-bundler.js would not work with ... If you do the production build, Vue I18n will automatically bundle the ...
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