Comments (15)
Hi,
I'll check it today.
Thanks
from redux-i18n.
Hi!
Do you have "redux-logger" or something like that for see the store before and after to dispatch action?
I have added some tests for check this and all works fine.
Can you show me your i18nState store content, please?
Thanks.
from redux-i18n.
prev state:
i18nState:{
lang: "en"
}
action:
{
type: "REDUX_I18N_SET_LANGUAGE",
lang: "de-DE"
}
next state:
i18nState:{
lang: "de-DE"
}
Thats what happens in my store and thats what i would expect. But the component seems to use the string "de-DE" as-is but can't find any translation because the translations look like this:
export const i18n = {
translations: {
de: {
"Logout": "Abmelden",
},
},
};
from redux-i18n.
OMG!
You are right. I'm going to think how resolve it and upload a new version soon.
Thanks
from redux-i18n.
Hi,
I just created a new tag (1.1.2) that solve this problem. Please, try it and tell me if you find any errors.
Thank you so much.
from redux-i18n.
Thank you very much.
I tested the new version and 'de-DE' now works but only when i change the translations to:
export const i18n = {
translations: {
'de-DE': {
"Logout": "Abmelden",
},
},
};
It works for IE but not for firefox because firefox returns 'de' as language. I think the most robust approach would be to fall back to 'de' when 'de-DE' is not available in the translations.
Should i create a new issue for that?
from redux-i18n.
Hi!
I've modified import script for generate the file as you show me. If you run your import script (from .po to translation.js) you can see it.
Try it, please and tell me.
Best regards.
from redux-i18n.
We don't use a po file we write the translations.js directly.
from redux-i18n.
Hi,
I'm not sure I understand to you. I just uploaded a new versión with "demo" app. Please, can you pull from github, install demo app and try it?
Tell me if works fine on chrome, firefox, IE, etc...
Best regards.
from redux-i18n.
Hi,
sorry i didn't recognise the demo. I tried it an now it works for "de-DE" but not for "de" any more. Sometimes there are multiple language codes (e.g. "de-DE", "de-CH" or even "de") which should fall back to the same translation (e.g. "de").
In my case with the new version i would have to duplicate the translation: "de" and "de-DE"
Best regards
from redux-i18n.
Hi,
you can have as many languages as you want. For example:
export const translations = {
'de-DE': {
'Hello world!': 'Hallo Welt!',
},
'es': {
'Hello world!': '¡Hola mundo!',
},
'de-CH': {
'Hello world!': 'Hallo Welt!',
},
'de': {
'Hello world!': 'Hallo Welt!',
},
}
And then, activate the language that you need:
this.props.dispatch(setLanguage('de-CH'))
this.props.dispatch(setLanguage('de-DE'))
this.props.dispatch(setLanguage('de'))
For test "demo", you should checkout repo and:
cd demo
npm install
npm start
And go to: http://localhost:8000
Best regards.
from redux-i18n.
Hm i don't want to define a translation for every language ("de-DE", "de-CH") because the translations would be the same. They would be duplicates.
It would be much more convenient when languages like "de-DE" or "de-CH" have the fallback "de" so that i have to provide "de" only.
from redux-i18n.
Ok. Perfect :). Now I understand to you fine. I can make that if language is not in translations dictionary and has "-", make an split and take first part.
I like it, this is a good new feature.
Thanks!
from redux-i18n.
Hi!
You have a new version (1.1.4)
;)
Best regards.
from redux-i18n.
It works. Thank you very much :-)
from redux-i18n.
Related Issues (20)
- this.context.t is not a function react native 0.60.0 HOT 1
- Warning: componentWillMount has been renamed, and is not recommended for use HOT 1
- Reducer TypeScript definitition for combineReducers HOT 2
- doesn't work with react-native 0.64.2 HOT 1
- a vulnerability CVE-2020-7598 is introduced in redux-i18n HOT 7
- Translated strings don't rerender when new translations are set HOT 1
- Not working in react 18, <I18n /> component does not accept children HOT 2
- No reducer provided for key "i18nState" when added in combine reducer while doing react testing
- Uncaught TypeError: (0 , _reactRedux.connect) is not a function at ./node_modules/redux-i18n/dist/component/index.js HOT 2
- [Error][object Object] html-object-as-parameter HOT 2
- Redux-i18n accessing t() function outside React components, e.g. in action creators HOT 1
- Pluralization rules per language
- this.context.t is not a function HOT 2
- Generic type 'ThunkAction' requires 4 type argument(s). HOT 4
- how to pass to setLanguage to mapDispatchToProps HOT 1
- unwanted init of redux-i18n when page refreshes HOT 1
- Dynamic Fallback language when field doesn't exist. HOT 1
- Not able to call the t function from outside utility.
- override the default state HOT 1
- Why initialLang is not taken from state?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-i18n.