Skip to content

onMissingTranslation defaultTranslation variable parsing #101

@colbyfayock

Description

@colbyfayock

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Having a variable with a proceeding dollar sign doesn't render as expected when coming from an onMissingTranslation callback;

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
I forked another issue I found, but it provides the issue.
https://codesandbox.io/s/7rwkqzr7x

If you notice look at the above as is, after clicking "To ES", it creates an exception. This appears to be if you're missing a defaultLanguage attribute. That could be expected, though maybe it would make sense to default to the first value of the languages array?

The real issue, if you uncomment the defaultLanguage line, you'll notice you no longer get an exception, but the variable isn't properly getting parsed as it would in a typical translation.

What is the expected behavior?
$${variable} => $value

Which versions of react and react-localize-redux are you using?
react: 16.4.0
react-localize-redux: 5.0.7

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions