![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
react-i18n-jed
Advanced tools
React i18n for Gettext based on Jed
# With npm
npm i --save react-i18n-jed jed
# Or with yarn
yarn add react-i18n-jed jed
All the txt
, pluralTxt
and context
should be literal string.
gettext(txt)
pgettext(context, txt)
ngettext(txt, pluralTxt, count)
npgettext(context, txt, pluralTxt, count)
We should get the Jed instance to . Then we can get it from Component.props
in the whole components tree cooperated with translate()
.
import { I18nProvider } from 'react-i18n-jed';
import Jed from 'jed';
const i18n = new Jed(localeJSON);
<I18nProvider i18n={this.i18n}>
<WrappedComponent i18n={this.i18n} {...this.props} />
</I18nProvider>
The localeJSON
should match the standard Gettext data format, like
{
domain: 'messages',
language: 'en-US',
locale_data: {
messages: {
'': {
domain: 'messages',
},
'Ad Expense': ['Test Ad Expense'],
'App or Publisher': ['App or Publisher'],
Cat: ['Cat', 'Cats'],
},
},
}
import { translate, type I18nType } from 'react-i18n-jed';
class Comp extends React.Component {
props: {
i18n: I18nType,
};
render() {
const { gettext } = this.props.i18n;
return <div>{gettext('hello')}</div>;
}
}
export default translate(Comp);
In test files, you won't be able to use shallow
rendering with the translated component. Instead, you'll want to access the wrapped component directly like so:
import mockI18n from 'react-i18n-jed/mockI18n';
import TranslatedComponent from '.';
const Comp = TranslatedComponent.WrappedComponent;
const tree = shallow(<Comp i18n={mockI18n} />);
MIT © App Annie
FAQs
React i18n wrapper for jed, based on gettext
The npm package react-i18n-jed receives a total of 45 weekly downloads. As such, react-i18n-jed popularity was classified as not popular.
We found that react-i18n-jed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.