@things-factory/i18n-base 10.1.145 → 10.1.147

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/i18n-base",
3
- "version": "10.1.145",
3
+ "version": "10.1.147",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@operato/i18n": "^10.0.0",
31
- "@things-factory/auth-base": "^10.1.145",
32
- "@things-factory/shell": "^10.1.142"
31
+ "@things-factory/auth-base": "^10.1.147",
32
+ "@things-factory/shell": "^10.1.147"
33
33
  },
34
- "gitHead": "1c33612ba31f51b9af59f9bc68751971097350a5"
34
+ "gitHead": "df93dddb6ac19a27c32fad21e29ca0ce02d08eb6"
35
35
  }
@@ -0,0 +1,23 @@
1
+ import { readFileSync } from 'fs'
2
+ import path from 'path'
3
+
4
+ /*
5
+ * The server preloads the languages the framework speaks, by the language part of each configured code.
6
+ * It said 'jp' for Japanese until 2026-10-10 - i18next loaded nothing under that name, so a Japanese
7
+ * server-side message fell back to English.
8
+ */
9
+ const root = path.resolve(__dirname, '..')
10
+
11
+ const preloaded = () => {
12
+ const source = readFileSync(path.join(root, 'server', 'middlewares', 'index.ts'), 'utf-8')
13
+ const list = source.match(/preload:\s*\[([^\]]*)\]/)![1]
14
+ return [...list.matchAll(/'([^']+)'/g)].map(([, code]) => code).sort()
15
+ }
16
+
17
+ describe('the languages the server preloads', () => {
18
+ it.each(['config.development.js', 'config.production.js'])('are the languages %s lists', file => {
19
+ const { i18n } = require(path.join(root, 'config', file))
20
+ const configured = i18n.languages.map(({ code }: { code: string }) => code.split('-')[0]).sort()
21
+ expect(preloaded()).toEqual(configured)
22
+ })
23
+ })
@@ -9,12 +9,13 @@ import { terminologyChangeIssues, terminologyIssues } from '../server/ai-entry/t
9
9
  import { TERMINOLOGY_CATEGORIES, terminologyEntryTarget, terminologyEntryTargets } from '../server/ai-entry/terminology-entry-targets'
10
10
 
11
11
  import en from '../translations/en.json'
12
+ import es from '../translations/es.json'
12
13
  import ja from '../translations/ja.json'
13
14
  import ko from '../translations/ko.json'
14
15
  import ms from '../translations/ms.json'
15
16
  import zh from '../translations/zh.json'
16
17
 
17
- const LANGUAGES: Record<string, Record<string, string>> = { en, ja, ko, ms, zh }
18
+ const LANGUAGES: Record<string, Record<string, string>> = { en, es, ja, ko, ms, zh }
18
19
 
19
20
  const rootFields = (document: string) => {
20
21
  const operations = parse(document).definitions.filter((one: any) => one.kind === 'OperationDefinition') as any[]
@@ -34,7 +35,7 @@ describe('terminology entry target', () => {
34
35
  expect(() => declareEntryTarget(target as any)).not.toThrow()
35
36
  })
36
37
 
37
- it('without a list given, the locales are the configured languages (or the framework five)', () => {
38
+ it('without a list given, the locales are the configured languages (or the framework six)', () => {
38
39
  const locale = terminologyEntryTarget().fields.find(field => field.name === 'locale')!
39
40
  expect(locale.type).toBe('enum')
40
41
  expect(locale.values!.length).toBeGreaterThan(0)
@@ -0,0 +1,13 @@
1
+ {
2
+ "button.clear-cache": "borrar caché",
3
+ "field.category": "categoría",
4
+ "field.display": "visualización",
5
+ "field.locale": "configuración regional",
6
+ "label.i18n-entry-terminology": "terminología",
7
+ "text.NOTHING_SELECTED": "no hay nada seleccionado",
8
+ "text.clearing-cache": "borrando caché",
9
+ "text.i18n-entry-terminology-exists": "ya existe un término con esta configuración regional, categoría y nombre",
10
+ "text.i18n-entry-terminology-repeated": "misma configuración regional, categoría y nombre que una fila anterior",
11
+ "text.item view": "vista de elemento",
12
+ "title.terminology": "terminología"
13
+ }