eugene-manuilov / react-gettext Goto Github PK
View Code? Open in Web Editor NEWTiny React library for implementing gettext localization in your application.
License: MIT License
Tiny React library for implementing gettext localization in your application.
License: MIT License
While using withGettext method in order to internationalize the component, this librairy hide the concerning component from react application.
I don't find any way to get this component (eg. to use refs and method hosted inside).
Have you a suggestion or can you confirm that is currently not possible ?
I think we have to update the library in such a way that it will work with both versions of react. Means 16.3.0 as well as the pervious ones. Any suggestions on where we should start.
Line 237:
this.context.ngettext('day ago', 'days ago', numberOfDays);
This is a bad example of i18n string because in Hebrew (and in several other languages) we don't use the same word order so unless there's a placeholder in there I can't translate it so that Hebrew native speaker will understand.
A better approach would be (assuming I'm not messing up the parameters):
this.context.ngettext('{numberOfDays} day ago', '{numberOfDays} days ago', numberOfDays);
Another solution can be changing the example :)
After upgrading npm packages we got:
npm install
npm WARN [email protected] requires a peer of hoist-non-react-statics@^1.2.0 but none was installed.
"hoist-non-react-statics": "^2.2.2",
is recent
Could react-gettext support that recent version?
Hi,
could you maybe provide a typescript declaration file (react-gettext.d.ts)?
Would be nice to use your project in typescript projects!
While running npm start
. The preset used in webpack config is react
Is it possible to translate something like this:
ngettext('only {{ count }} night', 'only {{ count }} nights', 3)
As I see right now - there is no way to do it...
I followed the guide and everything works but I am still confused how can I implement multi-lingual react application.
The docs say, getTranslations() function should returns hash object where keys are original messages and values are translated messages but what should be the structure of this hash object when you have to distinguish between multiple locales (how to access locales in the function which are stored inside the state) and different contexts?
Thanks.
@eugene-manuilov It would be nice if you can document details about extracting strings and creating the .pot file. If you can just provide an overview, i can contribute the rest.
Hi, i have problem with generation mo file. When i add new localization (By poedit) and save it, mo file contain something like this
PO-Revision-Date: 2019-01-17 20:19+0300
Language-Team:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Generator: Poedit 2.0.6
X-Poedit-Basepath: ../../src
Plural-Forms: nplurals=2; plural=(n != 1);
X-Poedit-KeywordsList: gettext;ngettext:1,2;xgettext:1,2c;nxgettext:1,2,4c
X-Poedit-SourceCharset: UTF-8
Last-Translator:
Language: en
X-Poedit-SearchPath-0: components
username
But in your project mo.json files contain payload in json format. How can i change save format in poedit (or another editor)?
when I run the program, please help me. I don't know how to generate the '.pot' file?
Great little library! One thing I'm not seeing is the ability to change the application translation after initialization. Just want to confirm I'm not missing this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.