@tilde-nlp/ngx-translate 9.0.4 → 9.0.6
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/README.md
CHANGED
|
@@ -74,7 +74,7 @@ default value *[".doc", ".docx", ".docm", ".xlsx", ".pptx", ".odt", ".odp", ".od
|
|
|
74
74
|
".xhtml", ".xht", ".tmx", ".xlf", ".xlif", ".xliff", ".sdlxliff", ".sdlxlf", ".ttx", ".rtf",
|
|
75
75
|
".pages", ".tex", ".xml", ".json", ".sxw", ".pdf", ".csv", ".ttl", ".srt", ".png", ".jpg", ".jpeg", ".bmp"];*
|
|
76
76
|
|
|
77
|
-
**language** - UI language code.
|
|
77
|
+
**ui-language** - UI language code.
|
|
78
78
|
default value *en*
|
|
79
79
|
|
|
80
80
|
Supported languages:
|
|
@@ -86,7 +86,7 @@ Supported languages:
|
|
|
86
86
|
- fi (Finnish)
|
|
87
87
|
- pl (Polish)
|
|
88
88
|
|
|
89
|
-
**default-language** - UI fallback language.
|
|
89
|
+
**default-ui-language** - UI fallback language.
|
|
90
90
|
default value *en*
|
|
91
91
|
|
|
92
92
|
**show-extensions** - Show allowed extensions.
|
|
@@ -97,3 +97,9 @@ default value *true*
|
|
|
97
97
|
|
|
98
98
|
**is-auto-language-detection-enabled** - Enable or disable auto detection of source language.
|
|
99
99
|
defult value *true*
|
|
100
|
+
|
|
101
|
+
**src-language** - Set default source language. Keep empty to set "Detect language" as default.
|
|
102
|
+
defult value *AUTO* - if Language detection is enabled, if disabled *lv* is fallback default src language.
|
|
103
|
+
|
|
104
|
+
**trg-language** - Set default target language.
|
|
105
|
+
defult value *en*
|
|
@@ -4589,7 +4589,7 @@ const i18n_hr = {
|
|
|
4589
4589
|
},
|
|
4590
4590
|
"SYSTEM_PICKER": {
|
|
4591
4591
|
"SOURCE": "Prevedi s",
|
|
4592
|
-
"TARGET": "
|
|
4592
|
+
"TARGET": "Prevedi na",
|
|
4593
4593
|
"SEARCH_PLACEHOLDER": "Pretraživanje jezika",
|
|
4594
4594
|
"RECENT_SYSTEM_TITLE": "Nedavno",
|
|
4595
4595
|
"SELECT_DOMAIN": "Odaberi domenu",
|
|
@@ -4752,7 +4752,7 @@ class TldTranslateConfigService {
|
|
|
4752
4752
|
this._coreConfig.showDomainsWithLanguageName = core?.showDomainsWithLanguageName || false;
|
|
4753
4753
|
this._coreConfig.showDomains = core?.showDomains ?? true;
|
|
4754
4754
|
this._coreConfig.defaultVendor = core?.defaultVendor ?? "Tilde";
|
|
4755
|
-
this._coreConfig.
|
|
4755
|
+
this._coreConfig.defaultDomain = core?.defaultDomain ?? "general";
|
|
4756
4756
|
this._coreConfig.showDomainTitle = core?.showDomainTitle;
|
|
4757
4757
|
this._coreConfig.domainSide = core?.domainSide ?? "trg";
|
|
4758
4758
|
this._coreConfig.swapIconPosition = core?.swapIconPosition ?? "src";
|
|
@@ -4762,6 +4762,7 @@ class TldTranslateConfigService {
|
|
|
4762
4762
|
this._coreConfig.contactSupport = core?.contactSupport ?? true;
|
|
4763
4763
|
this._coreConfig.subscriptionSupport = core?.subscriptionSupport ?? true;
|
|
4764
4764
|
this._coreConfig.isWebComponent = core?.isWebComponent ?? false;
|
|
4765
|
+
this._coreConfig.defaultSourceLanguage = core?.defaultSourceLanguage ?? ((text?.isAutoLanguageDetectionEnabled ?? true) ? 'AUTO' : 'en');
|
|
4765
4766
|
this._coreConfig.defaultTargetLanguage = core?.defaultTargetLanguage ?? 'lv';
|
|
4766
4767
|
this._fileConfig.allowedFileTypes = file?.allowedFileTypes || [".pdf", ".docx", ".doc", ".pptx", ".xlsx", ".txt", ".odt", ".html", ".json", ".srt", ".rtf", ".pages", ".docm", ".odp", ".ods", ".htm", ".xhtml", ".xht", ".tmx", ".xlf", ".xlif", ".xliff", ".sdlxliff", ".sdlxlf", ".ttx", ".tex", ".xml", ".sxw", ".csv", ".jpg", ".jpeg", ".png", ".bmp"];
|
|
4767
4768
|
this._fileConfig.extendedFileTypes = file?.extendedFileTypes
|
|
@@ -5016,33 +5017,36 @@ class TldTranslateSystemManagementService {
|
|
|
5016
5017
|
});
|
|
5017
5018
|
return titles;
|
|
5018
5019
|
}
|
|
5019
|
-
init(
|
|
5020
|
+
init(languageId) {
|
|
5020
5021
|
this.systemService.getSystemList().subscribe({
|
|
5021
5022
|
next: (res) => {
|
|
5022
5023
|
this.systems = res;
|
|
5023
5024
|
if (res.length == 0) {
|
|
5024
5025
|
this.loadedSystemsSubject.next(res);
|
|
5025
5026
|
}
|
|
5026
|
-
if (!
|
|
5027
|
-
|
|
5027
|
+
if (!languageId) {
|
|
5028
|
+
languageId = this.getDefaultLanguageId();
|
|
5029
|
+
}
|
|
5030
|
+
if (!this.systemExists(languageId, this.systems) && !languageId?.includes(AUTO_LANGUAGE_DETECTION_KEY)) {
|
|
5031
|
+
languageId = this.systems[0]?.languageId;
|
|
5028
5032
|
for (const system of this.systems) {
|
|
5029
5033
|
const vendor = system.vendor;
|
|
5030
5034
|
if (vendor === this.defaultVendor) {
|
|
5031
|
-
|
|
5035
|
+
languageId = system.languageId;
|
|
5032
5036
|
break;
|
|
5033
5037
|
}
|
|
5034
5038
|
}
|
|
5035
5039
|
}
|
|
5036
|
-
if (
|
|
5040
|
+
if (languageId === AUTO_LANGUAGE_DETECTION_KEY) {
|
|
5037
5041
|
this.targetLanguage = this.defaultTargetLanguage;
|
|
5038
5042
|
}
|
|
5039
5043
|
this.createRecentSystemArray();
|
|
5040
5044
|
this.sourceLangList = this.createLangList(this.systems);
|
|
5041
|
-
this.changeSystem(
|
|
5045
|
+
this.changeSystem(languageId);
|
|
5042
5046
|
this.widgetInitialized = true;
|
|
5043
5047
|
this.sysList.next(this.systems);
|
|
5044
5048
|
this.noSystemsError = false;
|
|
5045
|
-
if (
|
|
5049
|
+
if (languageId === AUTO_LANGUAGE_DETECTION_KEY) {
|
|
5046
5050
|
this.enableLanguageDetection();
|
|
5047
5051
|
}
|
|
5048
5052
|
},
|
|
@@ -5131,6 +5135,9 @@ class TldTranslateSystemManagementService {
|
|
|
5131
5135
|
this.changeLanguage(this.activeSystem?.detectedLanguage ? AUTO_LANGUAGE_DETECTION_KEY : this.activeSystem.sourceLanguage, targetLanguageCode);
|
|
5132
5136
|
}
|
|
5133
5137
|
}
|
|
5138
|
+
getDefaultLanguageId() {
|
|
5139
|
+
return this.findCorrectSystem(this.config.coreConfig.defaultSourceLanguage, this.config.coreConfig.defaultTargetLanguage, this.config.coreConfig.defaultDomain);
|
|
5140
|
+
}
|
|
5134
5141
|
createRecentSystemArray() {
|
|
5135
5142
|
let systemIdArray;
|
|
5136
5143
|
const recentSystemArray = [];
|
|
@@ -5199,10 +5206,14 @@ class TldTranslateSystemManagementService {
|
|
|
5199
5206
|
const systems = this.systems;
|
|
5200
5207
|
if (sourceLanguage === AUTO_LANGUAGE_DETECTION_KEY) {
|
|
5201
5208
|
this.targetLanguage = targetLanguage;
|
|
5202
|
-
this.activeSystem
|
|
5209
|
+
if (this.activeSystem) {
|
|
5210
|
+
this.activeSystem.targetLanguage = targetLanguage;
|
|
5211
|
+
}
|
|
5203
5212
|
return `${AUTO_LANGUAGE_DETECTION_KEY}-${targetLanguage}`;
|
|
5204
5213
|
}
|
|
5205
|
-
const systemsForLanguagePair = systems.filter(system =>
|
|
5214
|
+
const systemsForLanguagePair = systems.filter(system => {
|
|
5215
|
+
return system.sourceLanguage === sourceLanguage && system.targetLanguage === targetLanguage && (!domain || system.domain === domain);
|
|
5216
|
+
});
|
|
5206
5217
|
if (systemsForLanguagePair.length === 0) {
|
|
5207
5218
|
return this.systems.find(system => system.sourceLanguage === sourceLanguage)?.languageId;
|
|
5208
5219
|
}
|
|
@@ -10175,7 +10186,7 @@ class TldTranslateWebsiteComponent {
|
|
|
10175
10186
|
this.initializeWidget();
|
|
10176
10187
|
}
|
|
10177
10188
|
initializeWidget() {
|
|
10178
|
-
this.tldSystem.init(this.tldSystem.getLastUsedSystem()
|
|
10189
|
+
this.tldSystem.init(this.tldSystem.getLastUsedSystem());
|
|
10179
10190
|
}
|
|
10180
10191
|
ngOnInit() {
|
|
10181
10192
|
if (this.configService.coreConfig.debug) {
|
|
@@ -10869,7 +10880,7 @@ class TldTranslateComponent {
|
|
|
10869
10880
|
this.initializeWidget();
|
|
10870
10881
|
}
|
|
10871
10882
|
initializeWidget() {
|
|
10872
|
-
this.tldSystem.init(this.tldSystem.getLastUsedSystem()
|
|
10883
|
+
this.tldSystem.init(this.tldSystem.getLastUsedSystem());
|
|
10873
10884
|
}
|
|
10874
10885
|
ngOnInit() {
|
|
10875
10886
|
this.iconService.registerIcons(icons);
|