@adminforth/i18n 1.0.0-next.1

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/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@adminforth/i18n",
3
+ "version": "1.0.0-next.1",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "tsc && rsync -av --exclude 'node_modules' custom dist/",
9
+ "rollout": "npm run build && npm version patch && npm publish --access public && npm run rollout-next",
10
+ "rollout-next": "npm run build && npm version prerelease --preid=next && npm publish --tag next",
11
+ "prepare": "npm link adminforth"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "ISC",
16
+ "description": "",
17
+ "dependencies": {
18
+ "@aws-sdk/client-ses": "^3.654.0",
19
+ "@sapphire/async-queue": "^1.5.5",
20
+ "chokidar": "^4.0.1",
21
+ "iso-639-1": "^3.1.3"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.10.7",
25
+ "i18n-iso-countries": "^7.13.0",
26
+ "semantic-release": "^24.2.1",
27
+ "semantic-release-slack-bot": "^4.0.2",
28
+ "typescript": "^5.7.3"
29
+ },
30
+ "release": {
31
+ "plugins": [
32
+ "@semantic-release/commit-analyzer",
33
+ "@semantic-release/release-notes-generator",
34
+ "@semantic-release/npm",
35
+ "@semantic-release/github",
36
+ [
37
+ "semantic-release-slack-bot",
38
+ {
39
+ "notifyOnSuccess": true,
40
+ "notifyOnFail": true,
41
+ "slackIcon": ":package:",
42
+ "markdownReleaseNotes": true
43
+ }
44
+ ]
45
+ ],
46
+ "branches": [
47
+ "main",
48
+ {
49
+ "name": "next",
50
+ "prerelease": true
51
+ }
52
+ ]
53
+ }
54
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include*/
4
+ "module": "node16", /* Specify what module code is generated. */
5
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
6
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. */
7
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
8
+ "strict": false, /* Enable all strict type-checking options. */
9
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
10
+ },
11
+ "exclude": ["node_modules", "dist", "custom"], /* Exclude files from compilation. */
12
+ }
package/types.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { CompletionAdapter, EmailAdapter } from 'adminforth';
2
+ import type { LanguageCode } from 'iso-639-1';
3
+
4
+
5
+ export interface PluginOptions {
6
+
7
+ /* List of ISO 639-1 language codes which you want to tsupport*/
8
+ supportedLanguages: LanguageCode[];
9
+
10
+ /**
11
+ * Each translation string will be stored in a separate field, you can remap it to existing columns using this option
12
+ * By default it will assume field are named like `${lang_code}_string` (e.g. 'en_string', 'uk_string', 'ja_string', 'fr_string')
13
+ */
14
+ translationFieldNames: Partial<Record<LanguageCode, string>>;
15
+
16
+ /**
17
+ * Each string has a category, e.g. it might come from 'frontend' or some message from backend or column name on backend
18
+ * To deliver translations efficiently we need to store the category of each string.
19
+ * We recommend to put index on this column
20
+ */
21
+ categoryFieldName: string;
22
+
23
+ /**
24
+ * Optional source field to store e.g. file name where it first was captured
25
+ */
26
+ sourceFieldName?: string;
27
+
28
+ /**
29
+ * Optional field to save list of completed translations
30
+ * Helps to filter out strings which are not translated. If you define this field plugin will automatically
31
+ */
32
+ completedFieldName?: string;
33
+
34
+ /**
35
+ * Optionally translation plugin supports LLM completion adapter (like OpenAI) for generating translations
36
+ * semiautomatically (creates a bulk action for generating translations)
37
+ */
38
+ completeAdapter?: CompletionAdapter
39
+ }