@ox0/i18n 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -0
- package/package.json +27 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_intl_eaae646e__ from "react-intl";
|
|
2
|
+
function Ox0I18nProvider({ children, locale = "en", messages = {} }) {
|
|
3
|
+
return /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE_react_intl_eaae646e__.IntlProvider, {
|
|
4
|
+
locale: locale,
|
|
5
|
+
messages: messages
|
|
6
|
+
}, children);
|
|
7
|
+
}
|
|
8
|
+
function useMessage(id, defaultMessage) {
|
|
9
|
+
const intl = (0, __WEBPACK_EXTERNAL_MODULE_react_intl_eaae646e__.useIntl)();
|
|
10
|
+
return intl.formatMessage({
|
|
11
|
+
defaultMessage,
|
|
12
|
+
id
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { Ox0I18nProvider, useMessage };
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ox0/i18n",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist"
|
|
6
|
+
],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"react": "^19.0.0",
|
|
19
|
+
"react-intl": "^7.0.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rslib build -c ../../rslib.config.ts",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
24
|
+
"lint": "oxlint .",
|
|
25
|
+
"test": "vitest run"
|
|
26
|
+
}
|
|
27
|
+
}
|