在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):whichsteveyp/react-localize开源软件地址(OpenSource Url):https://github.com/whichsteveyp/react-localize开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):react-localizeA simple React Context wrapper and text localization component for localizing strings. Documentation:Please refer to our gitbook documentation for more detailed information & resources. Getting Started, Quickly:npm, Inc.*:Install it from
*or via Example of usage:import { LocalizationProvider, LocalizationConsumer } from 'react-localize';
// this should come from your server or localization strings bundle source
// for your application.
const localizationBundle = {
'app.button.Submit': 'Submit',
foo: {
bar: 'Hey %s, you must be %d years old?'
}
};
<LocalizationProvider messages={localizationBundle}>
<AnyParentComponent>
<LocalizationConsumer>
{({ localize }) => {
return <div>
<h1>{localize('prop.MissingValue')}</h1>
<button>{localize('app.button.Submit')}</button>
<p>{localize('foo.bar', ['Stephen', 34])}</p>
</div>;
}}
</LocalizationConsumer>
</AnyParentComponent>
</LocalizationProvider>
// outputs:
// <div>
// <h1>prop.MissingValue</h1>
// <button>Submit</button>
// <p>Hey Stephen, you must be 34 years old?</p>
// </div> |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论