@adminforth/i18n 1.0.22-next.0 → 1.0.22

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/Changelog.md CHANGED
@@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.22] - next
8
+ ## [1.0.22]
9
+
10
+ ### Fixed
11
+
12
+ - More predictable class name
13
+ - When loading unique translations from category, they were not registered if existing in other category
9
14
 
10
15
 
11
16
  ## [1.0.21] - 2024-12-30
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ class AiTranslateError extends Error {
68
68
  this.name = 'AiTranslateError';
69
69
  }
70
70
  }
71
- export default class I18N extends AdminForthPlugin {
71
+ export default class I18nPlugin extends AdminForthPlugin {
72
72
  constructor(options) {
73
73
  super(options, import.meta.url);
74
74
  this.options = options;
@@ -654,7 +654,9 @@ ${JSON.stringify(strings.reduce((acc, s) => {
654
654
  yield Promise.all(missingKeysDeduplicated.map((missingKey) => __awaiter(this, void 0, void 0, function* () {
655
655
  const key = missingKey.en_string;
656
656
  const source = missingKey.source;
657
- const exists = yield adminforth.resource(this.resourceConfig.resourceId).count(Filters.EQ(this.enFieldName, key));
657
+ const exists = yield adminforth.resource(this.resourceConfig.resourceId).count([
658
+ Filters.EQ(this.enFieldName, key), Filters.EQ(this.options.categoryFieldName, category)
659
+ ]);
658
660
  if (exists) {
659
661
  return;
660
662
  }
package/index.ts CHANGED
@@ -66,7 +66,7 @@ class AiTranslateError extends Error {
66
66
  this.name = 'AiTranslateError';
67
67
  }
68
68
  }
69
- export default class I18N extends AdminForthPlugin {
69
+ export default class I18nPlugin extends AdminForthPlugin {
70
70
  options: PluginOptions;
71
71
  emailField: AdminForthResourceColumn;
72
72
  passwordField: AdminForthResourceColumn;
@@ -772,7 +772,9 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
772
772
  await Promise.all(missingKeysDeduplicated.map(async (missingKey: any) => {
773
773
  const key = missingKey.en_string;
774
774
  const source = missingKey.source;
775
- const exists = await adminforth.resource(this.resourceConfig.resourceId).count(Filters.EQ(this.enFieldName, key));
775
+ const exists = await adminforth.resource(this.resourceConfig.resourceId).count([
776
+ Filters.EQ(this.enFieldName, key), Filters.EQ(this.options.categoryFieldName, category)
777
+ ]);
776
778
  if (exists) {
777
779
  return;
778
780
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@adminforth/i18n",
3
- "version": "1.0.22-next.0",
3
+ "version": "1.0.22",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "tsc && rsync -av --exclude 'node_modules' custom dist/",
9
- "rollout": "npm run build && npm version patch && npm publish --access public",
9
+ "rollout": "npm run build && npm version patch && npm publish --access public && npm run rollout-next",
10
10
  "rollout-next": "npm run build && npm version prerelease --preid=next && npm publish --tag next",
11
11
  "prepare": "npm link adminforth"
12
12
  },