diff --git a/bun.lock b/bun.lock index 434457ca..1a327253 100644 --- a/bun.lock +++ b/bun.lock @@ -15,6 +15,8 @@ "@angular/platform-browser": "22.2.3", "@angular/platform-browser-dynamic": "22.2.3", "@angular/router": "22.2.3", + "@apappas1129/ngx-fluent": "^22.0.3", + "@fluent/bundle": "^0.19.1", "@kompakkt/common": "git+https://github.com/Kompakkt/Common.git#1ff4f862a5464d8cd236755a900f3722202552a9", "@kompakkt/komponents": "git+https://github.com/Kompakkt/Komponents.git#7d4ad1ec8fa03e09ead55bbf667afea5db97f9f7", "@kompakkt/plugins": "git+https://github.com/Kompakkt/Plugins.git#4e2c0f4665f01be50104df4417cc08c5bb97bbba", @@ -42,6 +44,7 @@ "@types/pluralize": "^0.0.33", "@types/spark-md5": "^3.0.5", "concurrently": "^9.2.1", + "ngx-fluent-cli": "https://github.com/HeyItsBATMAN/ngx-fluent-cli", "oxlint": "^1.57.0", "oxlint-tsgolint": "^0.18.1", "ts-node": "~10.9.2", @@ -51,6 +54,8 @@ }, }, "trustedDependencies": [ + "tree-sitter-angular", + "tree-sitter", "@kompakkt/common", "@kompakkt/plugins", ], @@ -104,6 +109,8 @@ "@angular/router": ["@angular/router@22.2.3", "", { "dependencies": { "tslib": "^2.3.0" }, "peerDependencies": { "@angular/common": "22.2.3", "@angular/core": "22.2.3", "@angular/platform-browser": "22.2.3", "rxjs": "^6.5.3 || ^7.4.0" } }, "sha512-h4C3iJ3OXM9HItErmTo9fFrFRDj1DSqbvweHAWl8eYJvyuhDD80gBNgdpN8/5gpt9K1HV+PXk0YbyjyQ0zMfPA=="], + "@apappas1129/ngx-fluent": ["@apappas1129/ngx-fluent@22.0.3", "", { "dependencies": { "tslib": "^2.6.2" }, "peerDependencies": { "@angular/common": "^22.0.0", "@angular/core": "^22.0.0", "@fluent/bundle": ">= 0.18.0 < 1.0.0" } }, "sha512-u9aRuRANJlwDNsBus9MkY4lXpDEDVXeJN5+Eaw4VWwZEGorZNWcqulk5sN0+rMogXitdpaGVu47s1gSr/BcQ0A=="], + "@babel/code-frame": ["@babel/code-frame@8.0.6", "", { "dependencies": { "@babel/helper-validator-identifier": "^8.0.6", "js-tokens": "^10.0.0" } }, "sha512-uMHhvmDmwFiLuiozaoRYTZHqMFuu3fem/X9JY78lohAuLoh8LSGGC8JqUzo2cVuBsBxkjMZNk56CE7ock8Xxkw=="], "@babel/compat-data": ["@babel/compat-data@8.0.5", "", {}, "sha512-YLsYoQMvL8l8WrGpN3Zj7O1wK5LEBN+cQtux7BcuHyxIXve724XG+zuJ1n3U1cUweRtTzQOA4IHbuQw3N34SZw=="], @@ -348,6 +355,8 @@ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.2", "", { "os": "win32", "cpu": "x64" }, "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g=="], + "@fluent/bundle": ["@fluent/bundle@0.19.1", "", {}, "sha512-SWJLZrPamDPsJlFFOW1nkgN0j0rbPbmSdmK0XAoXlyqKieLtMVl4vzng3aR5pwKoUx0scug8+YY2oct3fdfy9A=="], + "@hapi/address": ["@hapi/address@5.1.1", "", { "dependencies": { "@hapi/hoek": "^11.0.2" } }, "sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA=="], "@hapi/formula": ["@hapi/formula@3.0.2", "", {}, "sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw=="], @@ -1296,7 +1305,11 @@ "negotiator": ["negotiator@0.6.4", "", {}, "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w=="], - "node-addon-api": ["node-addon-api@6.1.0", "", {}, "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA=="], + "ngx-fluent-cli": ["ngx-fluent-cli@github:HeyItsBATMAN/ngx-fluent-cli#cd7749e", { "dependencies": { "@fluent/bundle": "^0.19.1", "tree-sitter": "^0.25.1", "tree-sitter-angular": "^0.9.2" }, "bin": { "ngx-fluent-cli": "./index.ts" } }, "HeyItsBATMAN-ngx-fluent-cli-cd7749e", "sha512-gd3W2mfiAtnmtgX7w1Yb29GTD0+TqwtM4ELJ3r+1lZTgh4i+R6g7BGaK4J3sj9Z1/GKak0zT4VjKXl6rGOXfuQ=="], + + "node-addon-api": ["node-addon-api@8.9.2", "", {}, "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg=="], + + "node-gyp-build": ["node-gyp-build@4.8.4", "", { "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", "node-gyp-build-test": "build-test.js" } }, "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ=="], "node-gyp-build-optional-packages": ["node-gyp-build-optional-packages@5.2.2", "", { "dependencies": { "detect-libc": "^2.0.1" }, "bin": { "node-gyp-build-optional-packages": "bin.js", "node-gyp-build-optional-packages-optional": "optional.js", "node-gyp-build-optional-packages-test": "build-test.js" } }, "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw=="], @@ -1576,6 +1589,12 @@ "tree-kill": ["tree-kill@1.2.2", "", { "bin": { "tree-kill": "cli.js" } }, "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="], + "tree-sitter": ["tree-sitter@0.25.1", "", { "dependencies": { "node-addon-api": "^8.5.0", "node-gyp-build": "^4.8.4" }, "hasInstallScript": true }, "sha512-mrcEdkYtHfrK1A6fs3O6FxkBo0Qig5XUXqHhxUOQu0bmPo00QF4XaSx4edpazdHwxnSCjlGKGgIqWdaN4dvTLA=="], + + "tree-sitter-angular": ["tree-sitter-angular@0.9.2", "", { "dependencies": { "node-addon-api": "^8.2.2", "node-gyp-build": "^4.8.2", "tree-sitter-html": "^0.23.2" }, "peerDependencies": { "tree-sitter": "^0.21.1", "tree_sitter": "*" }, "optionalPeers": ["tree_sitter"], "hasInstallScript": true }, "sha512-jaC4JFZ2M1t25qlt23DeqLlGbi8mh80It0ZuTXg6OJo8yi24fZiMuNTKkb40av/g6V1RRp6nWrYPE4S6ISbgqg=="], + + "tree-sitter-html": ["tree-sitter-html@0.23.2", "", { "dependencies": { "node-addon-api": "^8.2.2", "node-gyp-build": "^4.8.2" }, "peerDependencies": { "tree-sitter": "^0.21.1" }, "optionalPeers": ["tree-sitter"], "hasInstallScript": true }, "sha512-TN+l+7cCeLx9db/1RhRSqMAZO/266Oh2BHb8J8hMSSFLuzYvFTYP/UnD3S0mny5awzw05KzFNgu2vnwzN9wVJg=="], + "ts-node": ["ts-node@10.9.2", "", { "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "optionalPeers": ["@swc/core", "@swc/wasm"], "bin": { "ts-node": "dist/bin.js", "ts-script": "dist/bin-script-deprecated.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js" } }, "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -1776,6 +1795,8 @@ "less/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], + "lmdb/node-addon-api": ["node-addon-api@6.1.0", "", {}, "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA=="], + "micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], "minimizer-webpack-plugin/schema-utils": ["schema-utils@4.8.1", "", { "dependencies": { "@types/json-schema": "^7.0.15", "ajv": "^8.20.0", "ajv-formats": "^3.0.1", "ajv-keywords": "^5.1.0" }, "peerDependencies": { "webpack": "^5.112.0" }, "optionalPeers": ["webpack"], "bin": { "schema-utils": "bin/schema-utils.js" } }, "sha512-x39pYlJPyH7Uge5QO64B9XGP9zLDc9WNmiQZc+CE3IzZPvMu3lHOuAMGpYNoPixEL7MSWlGhYTg5UlLSL8G6iw=="], diff --git a/extract-translations.ts b/extract-translations.ts deleted file mode 100644 index 69c5db41..00000000 --- a/extract-translations.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { readdir, readFile, stat, writeFile } from 'fs/promises'; -import { extname, join } from 'path'; - -const translateRegex = /\{\{\s*([^{|]+?)(?:\s*\|\s*translate\s*\}\})/gs; -const ternaryRegex = /([\?:]\s?('.+')){1,2}/gs; -const appPath = join(__dirname, 'src', 'app'); -const i18nPath = join(__dirname, 'src', 'assets', 'i18n'); -const languages = ['en', 'mn', 'de', 'fr', 'it', 'es']; - -const removeApostrophe = (str: string) => { - if (str[0] === "'" && str[str.length - 1] === "'") { - return str.substring(1, str.length - 1); - } - return str; -}; - -const extractTranslationsFromFile = async (file: string): Promise => { - const translations = new Array(); - const content = await readFile(file, 'utf8'); - let match; - while ((match = translateRegex.exec(content))) { - const capture = match[1] - .split(/[\n\r]/) - .map(line => line.trim()) - .join(' '); - const ternaryMatch = ternaryRegex.exec(capture); - if (ternaryMatch) { - const ternaryCaptures = ternaryMatch[2].split(':').map(line => line.trim()); - translations.push(...ternaryCaptures); - } else { - translations.push(capture); - } - } - return translations.map(removeApostrophe); -}; - -const aggregateFilePaths = async (directory: string): Promise => { - const files = await readdir(directory); - const filePaths = new Array(); - for (const file of files) { - const path = join(directory, file); - const pathStat = await stat(path); - if (pathStat.isDirectory()) { - filePaths.push(...(await aggregateFilePaths(join(directory, file)))); - } else if (extname(file) === '.html') { - filePaths.push(path); - } - } - return filePaths; -}; - -const fileExists = async (path: string) => { - try { - await stat(path); - return true; - } catch (e) { - return false; - } -}; - -const combineTranslations = async (translations: string[]) => { - const translateObj: Record = {}; - for (const translation of translations) { - translateObj[translation] = translation; - } - - for (const language of languages) { - const path = join(i18nPath, `${language}.json`); - if (!(await fileExists(path))) { - await writeFile(path, JSON.stringify(translateObj, null, 2)); - continue; - } - const content = await readFile(path, 'utf8'); - const parsedContent = JSON.parse(content); - for (const key of Object.keys(translateObj)) { - if (!parsedContent[key]) { - parsedContent[key] = translateObj[key]; - } - } - await writeFile(path, JSON.stringify(parsedContent, null, 2)); - } -}; - -(async () => { - const paths = await aggregateFilePaths(appPath); - const translations = await Promise.all(paths.flatMap(extractTranslationsFromFile)); - const uniqueTranslations = Array.from(new Set(translations.flat())); - const sortedTranslations = uniqueTranslations.sort((a, b) => a.localeCompare(b)); - console.log( - `Found ${translations.flat().length}, unique ${sortedTranslations.length} translation strings`, - ); - await combineTranslations(sortedTranslations); - console.log(`Wrote translations for ${languages.length} languages: ${languages.join(', ')}`); -})(); diff --git a/machine-translation.ts b/machine-translation.ts deleted file mode 100644 index df4fea01..00000000 --- a/machine-translation.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { readdir, readFile, stat, writeFile } from 'fs/promises'; -import { extname, join } from 'path'; - -const i18nPath = join(__dirname, 'src', 'assets', 'i18n'); -const files = await readdir(i18nPath); - -for (const file of files) { - const content = await readFile(join(i18nPath, file), 'utf8'); - const json = JSON.parse(content); - const language = file.split('.')[0]!; - if (language === 'en' || language === 'mn') continue; - - console.log('Translating en to ' + language); - console.time('translation_' + language); - - for (const [translationKey, translation] of Object.entries(json)) { - if (translationKey !== translation) continue; - - const response = await fetch('http://localhost:5000/translate', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - q: translation, - source: 'en', - target: language, - format: 'text', - api_key: '', - }), - }); - const { translatedText } = (await response.json()) as { translatedText: string }; - json[translationKey] = translatedText; - } - - console.timeEnd('translation_' + language); - - await writeFile(join(i18nPath, file), JSON.stringify(json, null, 2)); -} diff --git a/package.json b/package.json index 2ccf74d5..0b5e6351 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "update:kompakkt:server-openapi": "bun run update-git-dependency.ts -d @kompakkt/server-openapi -o Kompakkt -r Server -b openapi-types", "e2e": "concurrently \"ng serve --port 1503\" \"wait-on http-get://localhost:1503 && npm run cy:run\" --kill-others --success first", "e2e-gui": "concurrently \"ng serve --port 1503\" \"wait-on http-get://localhost:1503 && npm run cy:open\" --kill-others --success first", - "extract-translations": "ts-node --skipProject ./extract-translations.ts" + "i18n:verify": "bun run ngx-fluent-cli --fluent-file-dir ./src/assets/i18n" }, "contributors": [ { @@ -52,6 +52,8 @@ "@angular/platform-browser": "22.2.3", "@angular/platform-browser-dynamic": "22.2.3", "@angular/router": "22.2.3", + "@apappas1129/ngx-fluent": "^22.0.3", + "@fluent/bundle": "^0.19.1", "@kompakkt/common": "git+https://github.com/Kompakkt/Common.git#1ff4f862a5464d8cd236755a900f3722202552a9", "@kompakkt/komponents": "git+https://github.com/Kompakkt/Komponents.git#7d4ad1ec8fa03e09ead55bbf667afea5db97f9f7", "@kompakkt/plugins": "git+https://github.com/Kompakkt/Plugins.git#4e2c0f4665f01be50104df4417cc08c5bb97bbba", @@ -79,6 +81,7 @@ "@types/pluralize": "^0.0.33", "@types/spark-md5": "^3.0.5", "concurrently": "^9.2.1", + "ngx-fluent-cli": "https://github.com/HeyItsBATMAN/ngx-fluent-cli", "oxlint": "^1.57.0", "oxlint-tsgolint": "^0.18.1", "ts-node": "~10.9.2", @@ -96,6 +99,8 @@ }, "trustedDependencies": [ "@kompakkt/common", - "@kompakkt/plugins" + "@kompakkt/plugins", + "tree-sitter", + "tree-sitter-angular" ] } diff --git a/src/app/app.config.ts b/src/app/app.config.ts index ec227fbd..6a7d4b9f 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -1,13 +1,7 @@ import { DragDropModule } from '@angular/cdk/drag-drop'; import { CommonModule, DATE_PIPE_DEFAULT_OPTIONS } from '@angular/common'; import { provideHttpClient, withInterceptors } from '@angular/common/http'; -import { - ApplicationConfig, - LOCALE_ID, - importProvidersFrom, - inject, - provideAppInitializer, -} from '@angular/core'; +import { ApplicationConfig, LOCALE_ID, importProvidersFrom } from '@angular/core'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; @@ -43,15 +37,16 @@ import { withRouterConfig, withRouterResources, } from '@angular/router'; -import { TranslatePipe } from 'src/app/pipes/translate.pipe'; +import { NgxFluentPipe } from '@apappas1129/ngx-fluent'; import { RouteReuse } from 'src/app/route-reuse-strategy'; import { exploreTimingInterceptor } from 'src/app/services/interceptors/explore-timing-interceptor'; import { httpErrorInterceptor } from 'src/app/services/interceptors/http-error-interceptor'; import { httpOptionsInterceptor } from 'src/app/services/interceptors/http-options-interceptor'; import { jwtInterceptor } from './services/interceptors/jwt-interceptor'; -import { TranslateService } from 'src/app/services/translate.service'; import { pluginProviders } from './app.plugin'; import { routes } from './app.routes'; +import { provideNgxFluent } from '@apappas1129/ngx-fluent'; +import { languageSources } from './app.fluent-sources'; export const appConfig: ApplicationConfig = { providers: [ @@ -86,8 +81,7 @@ export const appConfig: ApplicationConfig = { MatProgressBarModule, MatSortModule, ), - TranslateService, - TranslatePipe, + NgxFluentPipe, { provide: RouteReuseStrategy, useClass: RouteReuse }, provideRouter( routes, @@ -95,7 +89,7 @@ export const appConfig: ApplicationConfig = { withComponentInputBinding(), withRouterResources(), ), - provideAppInitializer(() => inject(TranslateService).requestLanguage('en')), + provideNgxFluent({ defaultLocale: 'en', sources: languageSources }), { provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: { dateFormat: 'full' } }, { provide: LOCALE_ID, useValue: 'en-US' }, provideAnimations(), diff --git a/src/app/app.fluent-sources.ts b/src/app/app.fluent-sources.ts new file mode 100644 index 00000000..b1918370 --- /dev/null +++ b/src/app/app.fluent-sources.ts @@ -0,0 +1,15 @@ +export const languageNames = { + en: 'English', + de: 'Deutsch (German)', + fr: 'Français (French)', + it: 'Italiano (Italian)', + es: 'Español (Spanish)', + mn: 'монгол хэл (Mongolian)', +} as const; + +export type LanguageKey = keyof typeof languageNames; + +export const languageSources = { + en: 'assets/i18n/en.ftl', + de: 'assets/i18n/de.ftl', +} as const satisfies Partial>; diff --git a/src/app/components/actionbar/actionbar.component.html b/src/app/components/actionbar/actionbar.component.html index 4041f5b3..e2483aaf 100644 --- a/src/app/components/actionbar/actionbar.component.html +++ b/src/app/components/actionbar/actionbar.component.html @@ -7,8 +7,10 @@ mat-flat-button color="primary" [matTooltip]=" - (isPublished() ? 'Published. Click to unpublish!' : 'Not public. Click to publish!') - | translate + (isPublished() + ? 'actionbar-publish-tooltip-published' + : 'actionbar-publish-tooltip-unpublished' + ) | fluent " [disabled]="isUpdatingPublishState()" (click)="togglePublished()" @@ -16,17 +18,17 @@ @if (isUpdatingPublishState()) { - {{ 'Updating' | translate }}... + {{ 'actionbar-publish-button-updating' | fluent }} } @else if (isPublished()) { flip_to_back - {{ 'Unpublish' | translate }} + {{ 'actionbar-publish-button-unpublish' | fluent }} } @else { publish - {{ 'Publish!' | translate }} + {{ 'actionbar-publish-button-publish' | fluent }} } @@ -38,14 +40,19 @@
} @else if (isDetailPage()) {
} @@ -64,8 +71,8 @@
@@ -109,9 +116,9 @@
} @@ -171,7 +178,7 @@ > } @@ -182,17 +189,17 @@ } -
+
@@ -200,17 +207,16 @@ @for (compilation of selectHistory.usedInCompilations.compilations; track compilation._id) { } @if (canEditMetadata()) { } @if (isFinished() && canTransferOwnership()) { } } @@ -258,13 +264,9 @@

{{ compilationDescription() }}

+

{{ 'actionbar-info-object-count' | fluent: { count: entityCount() } }}

- {{ entityCount() }} - {{ 'objects' | translate }} -

-

- {{ 'Creator: ' }} - {{ element.creator.fullname }} + {{ 'actionbar-info-creator-label' | fluent: { name: element.creator.fullname } }}

} diff --git a/src/app/components/actionbar/actionbar.component.scss b/src/app/components/actionbar/actionbar.component.scss index 5c79b24b..091e999a 100644 --- a/src/app/components/actionbar/actionbar.component.scss +++ b/src/app/components/actionbar/actionbar.component.scss @@ -76,8 +76,4 @@ font-size: 16px !important; font-weight: bold; } - - .info-bold { - font-weight: bold; - } } diff --git a/src/app/components/actionbar/actionbar.component.ts b/src/app/components/actionbar/actionbar.component.ts index 01315574..8b41cfc8 100644 --- a/src/app/components/actionbar/actionbar.component.ts +++ b/src/app/components/actionbar/actionbar.component.ts @@ -22,7 +22,7 @@ import { } from '@kompakkt/common'; import { IsCompilationPipe } from 'src/app/pipes/is-compilation.pipe'; import { IsEntityPipe } from 'src/app/pipes/is-entity.pipe'; -import { TranslatePipe } from '../../pipes/translate.pipe'; +import { NgxFluentPipe } from '@apappas1129/ngx-fluent'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { OverlayModule } from '@angular/cdk/overlay'; import { PermissionService } from 'src/app/services/permissions.service'; @@ -50,7 +50,7 @@ import { SelectHistoryService } from 'src/app/services/select-history.service'; OverlayModule, RouterLink, MatMenuModule, - TranslatePipe, + NgxFluentPipe, IsCompilationPipe, IsEntityPipe, ], diff --git a/src/app/components/combined-form-errors/combined-form-errors.component.html b/src/app/components/combined-form-errors/combined-form-errors.component.html index c86d3c1e..b34e0c07 100644 --- a/src/app/components/combined-form-errors/combined-form-errors.component.html +++ b/src/app/components/combined-form-errors/combined-form-errors.component.html @@ -2,7 +2,7 @@ @if (error.fieldTree().touched()) { @if (error.message; as message) {
- {{ message | translate }} + {{ message | fluent }}
} } diff --git a/src/app/components/combined-form-errors/combined-form-errors.component.ts b/src/app/components/combined-form-errors/combined-form-errors.component.ts index 1ba08cac..75c24427 100644 --- a/src/app/components/combined-form-errors/combined-form-errors.component.ts +++ b/src/app/components/combined-form-errors/combined-form-errors.component.ts @@ -1,9 +1,9 @@ import { Component, computed, input } from '@angular/core'; import { FieldTree } from '@angular/forms/signals'; -import { TranslatePipe } from 'src/app/pipes/translate.pipe'; +import { NgxFluentPipe } from '@apappas1129/ngx-fluent'; @Component({ - imports: [TranslatePipe], + imports: [NgxFluentPipe], selector: 'app-combined-form-errors', styleUrl: './combined-form-errors.component.scss', templateUrl: './combined-form-errors.component.html', diff --git a/src/app/components/compilation-detail/compilation-detail.component.html b/src/app/components/compilation-detail/compilation-detail.component.html index 40dd624a..898d8e77 100644 --- a/src/app/components/compilation-detail/compilation-detail.component.html +++ b/src/app/components/compilation-detail/compilation-detail.component.html @@ -4,16 +4,23 @@

{{ compilation.name }}

{{ compilation.description }}

-

{{ 'Collection information' | translate }}

+

{{ 'compilation-detail-info-heading' | fluent }}

- {{ 'Contains' | translate }} {{ entityCount() }} - {{ 'objects across the following types:' | translate }} + {{ 'compilation-detail-types-message' | fluent: { count: entityCount() } }}

-
image
-
language
-
audiotrack
-
movie
+
+ image +
+
+ language +
+
+ audiotrack +
+
+ movie +
{{ imageCount() }} {{ modelCount() }} {{ audioCount() }} @@ -21,15 +28,15 @@

{{ 'Collection information' | translate }}


- {{ 'Total annotations' | translate }} + {{ 'compilation-detail-annotations-label' | fluent }} more {{ annotationCount() }}
@if (entityCount() > 0) {
-

{{ 'Collection objects' | translate }}

- {{ 'Objects in this collection:' | translate }} +

{{ 'compilation-detail-objects-heading' | fluent }}

+ {{ 'compilation-detail-objects-label' | fluent }}
@for (entity of entities(); track entity._id) { @if (entity.finished) { diff --git a/src/app/components/compilation-detail/compilation-detail.component.ts b/src/app/components/compilation-detail/compilation-detail.component.ts index d4aa2f13..1e2f8a1a 100644 --- a/src/app/components/compilation-detail/compilation-detail.component.ts +++ b/src/app/components/compilation-detail/compilation-detail.component.ts @@ -3,13 +3,13 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { RouterLink } from '@angular/router'; import { ICompilation, IEntity, isEntity } from '@kompakkt/common'; -import { TranslatePipe } from '../../pipes/translate.pipe'; +import { NgxFluentPipe } from '@apappas1129/ngx-fluent'; @Component({ selector: 'app-compilation-detail', templateUrl: './compilation-detail.component.html', styleUrls: ['./compilation-detail.component.scss'], - imports: [MatTooltipModule, MatIconModule, RouterLink, TranslatePipe], + imports: [MatTooltipModule, MatIconModule, RouterLink, NgxFluentPipe], }) export class CompilationDetailComponent { compilation = input(); diff --git a/src/app/components/entity-detail/detail-entity/detail-entity.component.html b/src/app/components/entity-detail/detail-entity/detail-entity.component.html index 8a4309fa..212f9c39 100644 --- a/src/app/components/entity-detail/detail-entity/detail-entity.component.html +++ b/src/app/components/entity-detail/detail-entity/detail-entity.component.html @@ -2,14 +2,14 @@ @if (physicalEntity(); as physicalEntity) { -

{{ 'Reference object' | translate }}

+

{{ 'detail-entity-reference-object-heading' | fluent }}

{{ physicalEntity.title }}

{{ physicalEntity.description }}

@if (physicalEntity.collection) {

{{ physicalEntity.collection }}

} @if (hasDimensions()) { -

{{ 'Dimensions' | translate }}:

+

{{ 'detail-entity-dimensions-heading' | fluent }}:

@for (dimension of dimensions(); track dimension) {

@@ -22,7 +22,7 @@

{{ physicalEntity.title }}

} @if (address(); as address) {
-

{{ 'Location' | translate }}:

+

{{ 'detail-entity-location-heading' | fluent }}:

@if (place(); as place) {

{{ place.name }}

} @@ -67,7 +67,7 @@

{{ physicalEntity.title }}

} @if (hasPersonsOrInstitutions()) { -

{{ 'Persons and Institutions' | translate }}:

+

{{ 'detail-entity-persons-institutions-heading' | fluent }}:

@if (persons(); as persons) { @for (person of persons; track person) { @@ -82,7 +82,7 @@

{{ physicalEntity.title }}

} @if (hasExternalIds()) { -

{{ 'External identifiers' | translate }}:

+

{{ 'detail-entity-external-identifiers-heading' | fluent }}:

@for (identifier of externalIds(); track identifier) {

{{ identifier.type }}: @@ -91,7 +91,7 @@

{{ physicalEntity.title }}

} } @if (hasExternalLinks()) { -

{{ 'External links' | translate }}:

+

{{ 'detail-entity-external-links-heading' | fluent }}:

@for (link of externalLinks(); track link) {
@@ -101,7 +101,7 @@

{{ physicalEntity.title }}

} } @if (hasBibRefs()) { -

{{ 'Bibliographic references' | translate }}:

+

{{ 'detail-entity-biblio-refs-heading' | fluent }}:

@for (ref of bibRefs(); track ref) {
@if (ref.description) { @@ -118,7 +118,7 @@

{{ physicalEntity.title }}

} } @if (hasMetadataFiles()) { -

{{ 'Attached files' | translate }}:

+

{{ 'detail-entity-attached-files-heading' | fluent }}:

@for (file of metadataFiles(); track file) {