@spscommerce/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/README.md +46 -0
- package/lib/SpsLanguage.d.ts +2 -0
- package/lib/index.cjs.js +2 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.es.js +4249 -0
- package/lib/localize.d.ts +21 -0
- package/lib/useSpsLanguage.d.ts +1 -0
- package/locales/en-US/design-system.json +138 -0
- package/locales/fr-CA/design-system.json +5 -0
- package/package.json +41 -0
- package/update.js +16 -0
- package/vite.config.js +20 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InitOptions } from "i18next";
|
|
2
|
+
export interface IDetectorOptions {
|
|
3
|
+
order?: string[];
|
|
4
|
+
lookupQuerystring?: string;
|
|
5
|
+
lookupCookie?: string;
|
|
6
|
+
lookupSessionStorage?: string;
|
|
7
|
+
lookupLocalStorage?: string;
|
|
8
|
+
caches?: string[];
|
|
9
|
+
excludeCacheFor?: string[];
|
|
10
|
+
cookieOptions?: any;
|
|
11
|
+
}
|
|
12
|
+
export interface ILocalizeOptions extends InitOptions {
|
|
13
|
+
detectorConfig?: IDetectorOptions;
|
|
14
|
+
customDetectors?: Array<{
|
|
15
|
+
name: string;
|
|
16
|
+
lookup: (options: IDetectorOptions) => string | undefined;
|
|
17
|
+
cacheUserLanguage?: (lang: string, options: IDetectorOptions) => void;
|
|
18
|
+
}>;
|
|
19
|
+
translationPath?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function localize({ detectorConfig, translationPath, customDetectors, ...i18nConfig }: ILocalizeOptions): Promise<import("i18next").TFunction>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSpsLanguage(ns?: string, options?: any): import("react-i18next").UseTranslationResponse<string[], undefined>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{
|
|
2
|
+
"advancedSearch": {
|
|
3
|
+
"clear": "Clear Fields",
|
|
4
|
+
"search": "Search"
|
|
5
|
+
},
|
|
6
|
+
"button": {
|
|
7
|
+
"spinningTitle": "Loading…"
|
|
8
|
+
},
|
|
9
|
+
"columnChooser": {
|
|
10
|
+
"removeButton": "Remove {{elementName}}"
|
|
11
|
+
},
|
|
12
|
+
"contentRow": {
|
|
13
|
+
"collapse": "Collapse",
|
|
14
|
+
"expand": "Expand"
|
|
15
|
+
},
|
|
16
|
+
"datepicker": {
|
|
17
|
+
"calendar": {
|
|
18
|
+
"prevMonth": "View Previous Month",
|
|
19
|
+
"nextMonth": "View Next Month"
|
|
20
|
+
},
|
|
21
|
+
"preset": {
|
|
22
|
+
"custom": "Custom",
|
|
23
|
+
"today": "Today",
|
|
24
|
+
"sevenDays": "Last 7 days",
|
|
25
|
+
"thirtyDays": "Last 30 days",
|
|
26
|
+
"sixtyDays": "Last 60 days",
|
|
27
|
+
"ninetyDays": "Last 90 days",
|
|
28
|
+
"oneYear": "Last year"
|
|
29
|
+
},
|
|
30
|
+
"presetsLabel": "Ranges"
|
|
31
|
+
},
|
|
32
|
+
"fileUpload": {
|
|
33
|
+
"acceptedTypes": "{{fileTypes}} format accepted",
|
|
34
|
+
"acceptedTypes_plural": "{{fileTypes}} formats accepted",
|
|
35
|
+
"cancelled": "File Upload Failed",
|
|
36
|
+
"cancelled_plural": "File Upload(s) Failed",
|
|
37
|
+
"close": "Close",
|
|
38
|
+
"instructions": "Drag and drop your file here or |browse for a file| on your desktop.",
|
|
39
|
+
"instructions_plural": "Drag and drop your files here or |browse for files| on your desktop.",
|
|
40
|
+
"maximumSize": "{{size}} maximum",
|
|
41
|
+
"processing": "Processing Upload…",
|
|
42
|
+
"title": "Upload Your {{description}}"
|
|
43
|
+
},
|
|
44
|
+
"filterPanel": {
|
|
45
|
+
"clear": "Clear Filters",
|
|
46
|
+
"title": "Filters",
|
|
47
|
+
"filterPlaceholder": "Filter options"
|
|
48
|
+
},
|
|
49
|
+
"focusedTask": {
|
|
50
|
+
"close": "Close"
|
|
51
|
+
},
|
|
52
|
+
"growler": {
|
|
53
|
+
"dismiss": "Dismiss"
|
|
54
|
+
},
|
|
55
|
+
"insightCard": {
|
|
56
|
+
"all": "ALL",
|
|
57
|
+
"partnerCount": "{{count}} |of| {{total}}",
|
|
58
|
+
"partners": "PARTNERS"
|
|
59
|
+
},
|
|
60
|
+
"insightTile": {
|
|
61
|
+
"all": "ALL",
|
|
62
|
+
"partnerCount": "{{count}} |of| {{total}}",
|
|
63
|
+
"partners": "PARTNERS"
|
|
64
|
+
},
|
|
65
|
+
"label": {
|
|
66
|
+
"errors": {
|
|
67
|
+
"dateConstraint": {
|
|
68
|
+
"max": "Please enter a date on or prior to {{context.maxExceeded}}.",
|
|
69
|
+
"min": "Please enter a date on or after {{context.minExceeded}}."
|
|
70
|
+
},
|
|
71
|
+
"dateFormat": "Please enter a date in the format {{context}}.",
|
|
72
|
+
"dateRangeOrder": "End date cannot be before start date.",
|
|
73
|
+
"dateValidity": "Please enter a valid date.",
|
|
74
|
+
"max": "Please enter a value no greater than {{context}}.",
|
|
75
|
+
"maxLength": "Please enter no more than {{context}} characters.",
|
|
76
|
+
"min": "Please enter a value no less than {{context}}.",
|
|
77
|
+
"minLength": "Please enter at least {{context}} characters.",
|
|
78
|
+
"required": "This field is required."
|
|
79
|
+
},
|
|
80
|
+
"preventativeErrors": {
|
|
81
|
+
"maxLength": "This field accepts a maximum number of characters.",
|
|
82
|
+
"alpha": "This field accepts only alphabetic values.",
|
|
83
|
+
"numeric": "This field accepts only numerical values.",
|
|
84
|
+
"nonNumeric": "This field accepts only non-numerical values."
|
|
85
|
+
},
|
|
86
|
+
"stronglySuggested": "This field is strongly suggested."
|
|
87
|
+
},
|
|
88
|
+
"listActionBar": {
|
|
89
|
+
"clearSelected": "Clear Selected",
|
|
90
|
+
"itemsSelected": "Items Selected"
|
|
91
|
+
},
|
|
92
|
+
"listToolbar": {
|
|
93
|
+
"advancedSearchToggle": "Advanced Search"
|
|
94
|
+
},
|
|
95
|
+
"modal": {
|
|
96
|
+
"close": "Close modal",
|
|
97
|
+
"defaultButtonLabel": "Okay",
|
|
98
|
+
"defaultTitle": {
|
|
99
|
+
"general": "Action",
|
|
100
|
+
"info": "Info",
|
|
101
|
+
"success": "Success",
|
|
102
|
+
"warning": "Warning",
|
|
103
|
+
"serious-warning": "Warning"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"pagination": {
|
|
107
|
+
"nextPage": "Next Page",
|
|
108
|
+
"ofMany": "of many",
|
|
109
|
+
"ofPageCount": "of {{pageCount}}",
|
|
110
|
+
"page": "Page",
|
|
111
|
+
"prevPage": "Previous Page"
|
|
112
|
+
},
|
|
113
|
+
"progressBar": {
|
|
114
|
+
"closeButtonTitle": "Close progress bar"
|
|
115
|
+
},
|
|
116
|
+
"searchResultsBar": {
|
|
117
|
+
"clear": "Clear",
|
|
118
|
+
"clearResults": "Clear Results",
|
|
119
|
+
"count": "{{count}} of {{total}}",
|
|
120
|
+
"matchingResults": "Matching results",
|
|
121
|
+
"noAdvancedSearchSelections": "No Advanced Search Selections",
|
|
122
|
+
"results": "Results:"
|
|
123
|
+
},
|
|
124
|
+
"select": {
|
|
125
|
+
"defaultPlaceholder": "Select one…"
|
|
126
|
+
},
|
|
127
|
+
"slackLink": {
|
|
128
|
+
"label": "Chat"
|
|
129
|
+
},
|
|
130
|
+
"spinner": {
|
|
131
|
+
"defaultAltText": "Loading…"
|
|
132
|
+
},
|
|
133
|
+
"taskQueue": {
|
|
134
|
+
"clearCompleted": "Clear Completed",
|
|
135
|
+
"newTask": "You have a new task in your queue.",
|
|
136
|
+
"noTasks": "There are currently no tasks in your queue."
|
|
137
|
+
}
|
|
138
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spscommerce/i18n",
|
|
3
|
+
"description": "SPS Design System React components",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": "SPS Commerce",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/i18n",
|
|
8
|
+
"homepage": "https://github.com/spscommerce/design-system/tree/master/packages/@spscommerce/i18n#readme",
|
|
9
|
+
"main": "./lib/index.cjs.js",
|
|
10
|
+
"module": "./lib/index.es.js",
|
|
11
|
+
"types": "./lib/index.d.ts",
|
|
12
|
+
"bin": {
|
|
13
|
+
"sps-i18n-update": "./update.js"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"i18next": "^19.6.3",
|
|
20
|
+
"i18next-browser-languagedetector": "^5.0.1",
|
|
21
|
+
"i18next-http-backend": "^1.0.17",
|
|
22
|
+
"react-i18next": "^11.16.9"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^16.9.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/react": "^16.9.0",
|
|
29
|
+
"react": "^16.9.0",
|
|
30
|
+
"typescript": "^4.4.4"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
34
|
+
"build:js": "vite build",
|
|
35
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
36
|
+
"watch": "vite build --watch",
|
|
37
|
+
"clean": "git clean -fdX",
|
|
38
|
+
"pub": "pnpm pack && node ../../scripts/publish-package.js"
|
|
39
|
+
},
|
|
40
|
+
"readme": "[//]: # \"START_AUTOGENERATED\"\n\n## [@spscommerce/i18n](https://github.com/spscommerce/ui-angular/tree/master/packages/@spscommerce/i18n#readme)\n\n\n\n\n\nSPS Design System React components \n \n ### Installation \n \n ```shell\nnpm install --save @spscommerce/i18n\n```\n\n#### Peer Dependencies\n\n<div class=\"row\">\n <div class=\"col-5\"> \n <table class=\"sps-table\">\n <thead class=\"sps-table__head\">\n <tr class=\"sps-table__row\">\n <th class=\"sps-table__header\">\n <span class=\"sps-table__header-cell-body\"> \n Package\n </span>\n </th>\n <th class=\"sps-table__header text-right\">\n <span class=\"sps-table__header-cell-body\"> \n Version\n </span>\n </th>\n </tr>\n </thead>\n <tbody class=\"sps-table__body\">\n <tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://reactjs.org/\">react</a></td><td class=\"sps-table__cell text-right\">^16.9.0</td></tr>\n </tbody>\n </table>\n </div>\n <div class=\"col-7\">\n \n </div>\n</div>\n\n[//]: # \"END_AUTOGENERATED\"\n"
|
|
41
|
+
}
|
package/update.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
const dsLocalePath = "./node_modules/@spscommerce/i18n/locales";
|
|
5
|
+
const projectLocalePath = process.argv.length > 2
|
|
6
|
+
? process.argv[2].replace(/\/$/, "")
|
|
7
|
+
: "./public/locales";
|
|
8
|
+
|
|
9
|
+
const dsLocales = new Set(fs.readdirSync(dsLocalePath));
|
|
10
|
+
const projectLocales = fs.readdirSync(projectLocalePath);
|
|
11
|
+
|
|
12
|
+
for (const loc of projectLocales) {
|
|
13
|
+
if (dsLocales.has(loc)) {
|
|
14
|
+
fs.copyFileSync(`${dsLocalePath}/${loc}/design-system.json`, `${projectLocalePath}/${loc}/design-system.json`);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
|
|
5
|
+
import pkg from './package.json';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
11
|
+
formats: ['es', 'cjs'],
|
|
12
|
+
fileName: (format) => `index.${format}.js`,
|
|
13
|
+
},
|
|
14
|
+
outDir: path.resolve(__dirname, './lib'),
|
|
15
|
+
emptyOutDir: false,
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|