@angular/localize
Advanced tools
Comparing version
/** | ||
* @license Angular v20.2.0-next.0 | ||
* @license Angular v20.2.0-next.1 | ||
* (c) 2010-2025 Google LLC. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
/** | ||
* @license Angular v20.2.0-next.0 | ||
* @license Angular v20.2.0-next.1 | ||
* (c) 2010-2025 Google LLC. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
{ | ||
"name": "@angular/localize", | ||
"version": "20.2.0-next.0", | ||
"version": "20.2.0-next.1", | ||
"description": "Angular - library for localizing messages", | ||
@@ -70,4 +70,4 @@ "bin": { | ||
"peerDependencies": { | ||
"@angular/compiler": "20.2.0-next.0", | ||
"@angular/compiler-cli": "20.2.0-next.0" | ||
"@angular/compiler": "20.2.0-next.1", | ||
"@angular/compiler-cli": "20.2.0-next.1" | ||
}, | ||
@@ -74,0 +74,0 @@ "module": "./fesm2022/localize.mjs", |
@@ -14,3 +14,3 @@ | ||
checkDuplicateMessages | ||
} from "./chunk-7UITC7I7.js"; | ||
} from "./chunk-TZHZOBVD.js"; | ||
import { | ||
@@ -25,3 +25,3 @@ ArbTranslationParser, | ||
makeLocalePlugin | ||
} from "./chunk-6WAVAPO6.js"; | ||
} from "./chunk-IVRM6V2B.js"; | ||
import { | ||
@@ -36,5 +36,5 @@ Diagnostics, | ||
unwrapSubstitutionsFromLocalizeCall | ||
} from "./chunk-ARKHNZ5Y.js"; | ||
} from "./chunk-HR5KPXEW.js"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/index.js | ||
// packages/localize/tools/index.ts | ||
import { NodeJSFileSystem, setFileSystem } from "@angular/compiler-cli/private/localize"; | ||
@@ -75,2 +75,1 @@ setFileSystem(new NodeJSFileSystem()); | ||
*/ | ||
//# sourceMappingURL=index.js.map |
@@ -16,11 +16,16 @@ #!/usr/bin/env node | ||
parseFormatOptions | ||
} from "../../chunk-7UITC7I7.js"; | ||
import "../../chunk-ARKHNZ5Y.js"; | ||
} from "../../chunk-TZHZOBVD.js"; | ||
import "../../chunk-HR5KPXEW.js"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/extract/cli.js | ||
import { ConsoleLogger, LogLevel, NodeJSFileSystem, setFileSystem } from "@angular/compiler-cli/private/localize"; | ||
// packages/localize/tools/src/extract/cli.ts | ||
import { | ||
ConsoleLogger, | ||
LogLevel, | ||
NodeJSFileSystem, | ||
setFileSystem | ||
} from "@angular/compiler-cli/private/localize"; | ||
import { globSync } from "tinyglobby"; | ||
import yargs from "yargs"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/extract/index.js | ||
// packages/localize/tools/src/extract/index.js | ||
function extractTranslations({ rootPath: rootPath2, sourceFilePaths: sourceFilePaths2, sourceLocale, format: format2, outputPath: output, logger: logger2, useSourceMaps, useLegacyIds, duplicateMessageHandling: duplicateMessageHandling2, formatOptions: formatOptions2 = {}, fileSystem: fs }) { | ||
@@ -68,3 +73,3 @@ const basePath = fs.resolve(rootPath2); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/extract/cli.js | ||
// packages/localize/tools/src/extract/cli.ts | ||
process.title = "Angular Localization Message Extractor (localize-extract)"; | ||
@@ -160,2 +165,1 @@ var args = process.argv.slice(2); | ||
*/ | ||
//# sourceMappingURL=cli.js.map |
@@ -7,11 +7,16 @@ #!/usr/bin/env node | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/migrate/cli.js | ||
import { ConsoleLogger, LogLevel, NodeJSFileSystem, setFileSystem } from "@angular/compiler-cli/private/localize"; | ||
// packages/localize/tools/src/migrate/cli.ts | ||
import { | ||
ConsoleLogger, | ||
LogLevel, | ||
NodeJSFileSystem, | ||
setFileSystem | ||
} from "@angular/compiler-cli/private/localize"; | ||
import { globSync } from "tinyglobby"; | ||
import yargs from "yargs"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/migrate/index.js | ||
// packages/localize/tools/src/migrate/index.js | ||
import { getFileSystem } from "@angular/compiler-cli/private/localize"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/migrate/migrate.js | ||
// packages/localize/tools/src/migrate/migrate.js | ||
function migrateFile(sourceCode, mapping) { | ||
@@ -30,3 +35,3 @@ const legacyIds = Object.keys(mapping); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/migrate/index.js | ||
// packages/localize/tools/src/migrate/index.js | ||
function migrateFiles({ rootPath: rootPath2, translationFilePaths: translationFilePaths2, mappingFilePath, logger: logger2 }) { | ||
@@ -47,3 +52,3 @@ const fs2 = getFileSystem(); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/migrate/cli.js | ||
// packages/localize/tools/src/migrate/cli.ts | ||
var args = process.argv.slice(2); | ||
@@ -80,2 +85,1 @@ var options = yargs(args).option("r", { | ||
*/ | ||
//# sourceMappingURL=cli.js.map |
@@ -15,8 +15,8 @@ #!/usr/bin/env node | ||
makeLocalePlugin | ||
} from "../../chunk-6WAVAPO6.js"; | ||
} from "../../chunk-IVRM6V2B.js"; | ||
import { | ||
Diagnostics | ||
} from "../../chunk-ARKHNZ5Y.js"; | ||
} from "../../chunk-HR5KPXEW.js"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/cli.js | ||
// packages/localize/tools/src/translate/cli.ts | ||
import { NodeJSFileSystem, setFileSystem } from "@angular/compiler-cli/private/localize"; | ||
@@ -26,3 +26,3 @@ import { globSync } from "tinyglobby"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/output_path.js | ||
// packages/localize/tools/src/translate/output_path.js | ||
function getOutputPathFn(fs2, outputFolder) { | ||
@@ -33,6 +33,6 @@ const [pre, post] = outputFolder.split("{{LOCALE}}"); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/index.js | ||
// packages/localize/tools/src/translate/index.js | ||
import { getFileSystem, relativeFrom } from "@angular/compiler-cli/private/localize"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/asset_files/asset_translation_handler.js | ||
// packages/localize/tools/src/translate/asset_files/asset_translation_handler.js | ||
import { absoluteFrom } from "@angular/compiler-cli/private/localize"; | ||
@@ -66,3 +66,3 @@ var AssetTranslationHandler = class { | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/source_files/source_file_translation_handler.js | ||
// packages/localize/tools/src/translate/source_files/source_file_translation_handler.js | ||
import { absoluteFrom as absoluteFrom2 } from "@angular/compiler-cli/private/localize"; | ||
@@ -141,3 +141,3 @@ import babel from "@babel/core"; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/translation_files/translation_loader.js | ||
// packages/localize/tools/src/translate/translation_files/translation_loader.js | ||
var TranslationLoader = class { | ||
@@ -154,2 +154,24 @@ fs; | ||
} | ||
/** | ||
* Load and parse the translation files into a collection of `TranslationBundles`. | ||
* | ||
* @param translationFilePaths An array, per locale, of absolute paths to translation files. | ||
* | ||
* For each locale to be translated, there is an element in `translationFilePaths`. Each element | ||
* is an array of absolute paths to translation files for that locale. | ||
* If the array contains more than one translation file, then the translations are merged. | ||
* If allowed by the `duplicateTranslation` property, when more than one translation has the same | ||
* message id, the message from the earlier translation file in the array is used. | ||
* For example, if the files are `[app.xlf, lib-1.xlf, lib-2.xlif]` then a message that appears in | ||
* `app.xlf` will override the same message in `lib-1.xlf` or `lib-2.xlf`. | ||
* | ||
* @param translationFileLocales An array of locales for each of the translation files. | ||
* | ||
* If there is a locale provided in `translationFileLocales` then this is used rather than a | ||
* locale extracted from the file itself. | ||
* If there is neither a provided locale nor a locale parsed from the file, then an error is | ||
* thrown. | ||
* If there are both a provided locale and a locale parsed from the file, and they are not the | ||
* same, then a warning is reported. | ||
*/ | ||
loadBundles(translationFilePaths2, translationFileLocales2) { | ||
@@ -161,2 +183,5 @@ return translationFilePaths2.map((filePaths, index) => { | ||
} | ||
/** | ||
* Load all the translations from the file at the given `filePath`. | ||
*/ | ||
loadBundle(filePath, providedLocale) { | ||
@@ -194,2 +219,6 @@ const fileContents = this.fs.readFile(filePath); | ||
} | ||
/** | ||
* There is more than one `filePath` for this locale, so load each as a bundle and then merge | ||
* them all together. | ||
*/ | ||
mergeBundles(filePaths, providedLocale) { | ||
@@ -218,3 +247,3 @@ const bundles = filePaths.map((filePath) => this.loadBundle(filePath, providedLocale)); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/translator.js | ||
// packages/localize/tools/src/translate/translator.js | ||
var Translator = class { | ||
@@ -244,3 +273,3 @@ fs; | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/index.js | ||
// packages/localize/tools/src/translate/index.js | ||
function translateFiles({ sourceRootPath: sourceRootPath2, sourceFilePaths: sourceFilePaths2, translationFilePaths: translationFilePaths2, translationFileLocales: translationFileLocales2, outputPathFn: outputPathFn2, diagnostics: diagnostics2, missingTranslation: missingTranslation2, duplicateTranslation: duplicateTranslation2, sourceLocale: sourceLocale2 }) { | ||
@@ -262,3 +291,3 @@ const fs2 = getFileSystem(); | ||
// bazel-out/k8-fastbuild/bin/packages/localize/tools/src/translate/cli.js | ||
// packages/localize/tools/src/translate/cli.ts | ||
process.title = "Angular Localization Message Translator (localize-translate)"; | ||
@@ -333,3 +362,5 @@ var args = process.argv.slice(2); | ||
function convertArraysFromArgs(args2) { | ||
return args2.map((arg) => arg.startsWith("[") && arg.endsWith("]") ? arg.slice(1, -1).split(",").map((arg2) => arg2.trim()) : arg); | ||
return args2.map( | ||
(arg) => arg.startsWith("[") && arg.endsWith("]") ? arg.slice(1, -1).split(",").map((arg2) => arg2.trim()) : arg | ||
); | ||
} | ||
@@ -343,2 +374,1 @@ /** | ||
*/ | ||
//# sourceMappingURL=cli.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5849
2.2%288520
-17.89%69
-9.21%