Releases: daniloster/react-i18n-base
Releases · daniloster/react-i18n-base
Fixed publication
Added .npmignore to avoid the adoption of .gitignore, when .npmignore is not present.
Added component to consume internationalised content
Changes
- Added
I18nTranslatecomponent as a property of localised components - Added
mutation-helperas a dependency - Updated docs
Updated dev-dependency with vunerability
Changes
It does not affect consumers.
Updated docs and references
Changes
- Added home page link to package.json
- Added github url to package.json
- Added author to package.json
- Added reference to Home Page in the README.md
Using features from React 18.4.0
Description
There was an API change reasoning the breaking change.
Changes
- I18nProvider
- Removed property
localesfrom provided - Renamed property
defaultLocaletodefaultLanguage - Renamed property
localetoinitialLanguage - Renamed property
onChangeI18ntoonChangeLanguage
- Removed property
- Added methods to localised components
extendandfactory- extend: change globally the localisation json data for a specific component
- factory: creates new localised component with extension of localisation json data
Example
import { localise } from 'react-i18n-base';
const Greeting = ({ name, i18n }) => (<div>{i18n.greeting} {name}!</div>);
const jsonData = {
en: { greeting: 'Mr/Mrs' }
};
const LocalisedGreeting = localise(jsonData)(Greeting);
LocalisedGreeting.extend({
pt: { greeting: 'Sr/Sra' }
});
// The code above extend the localisation to all`LocalisedGreeting` instances
const NewSupportLocalisedGreeting = LocalisedGreeting.factory({
es: { greeting: 'Sr/Sra' }
});Note: After factoring, the LocalisedGreeting still have support to 2 languages (en, pt) whereas NewSupportLocalisedGreeting have support to 3 languages (en, pt, es)
[Corrupted]
v2.0.0 [skip ci] v2.0.0