@c8y/ngx-components 1023.14.201 → 1023.14.202
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/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs +2 -2
- package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-upgrade.mjs +23 -6
- package/fesm2022/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs +2 -2
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +2 -2
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/locales/locales.pot +7 -9
- package/package.json +1 -1
|
@@ -946,20 +946,37 @@ function gettextCatalogDecorator($delegate, $interpolate, c8yTranslate) {
|
|
|
946
946
|
'ngInject';
|
|
947
947
|
const gettextCatalog = $delegate;
|
|
948
948
|
const originalGetString = angular.bind(gettextCatalog, gettextCatalog.getString);
|
|
949
|
+
const originalGetPlural = angular.bind(gettextCatalog, gettextCatalog.getPlural);
|
|
949
950
|
function newGetString(input, scope, context) {
|
|
950
951
|
if (typeof input === 'string') {
|
|
951
952
|
const translatedString = originalGetString(input, scope, context);
|
|
952
953
|
const interpolatedString = scope ? $interpolate(input)(scope) : input;
|
|
953
|
-
|
|
954
|
-
if (translatedString && translatedString === interpolatedString) {
|
|
955
|
-
const translatedServerMessage = c8yTranslate.instant(interpolatedString);
|
|
956
|
-
stringToReturn = translatedServerMessage;
|
|
957
|
-
}
|
|
958
|
-
return stringToReturn;
|
|
954
|
+
return fallBackToC8yTranslate(translatedString, interpolatedString);
|
|
959
955
|
}
|
|
960
956
|
return input;
|
|
961
957
|
}
|
|
958
|
+
function newGetPlural(count, input, inputPlural, scope, context) {
|
|
959
|
+
const sourceString = count === 1 ? input : inputPlural;
|
|
960
|
+
if (typeof sourceString === 'string') {
|
|
961
|
+
const translatedString = originalGetPlural(count, input, inputPlural, scope, context);
|
|
962
|
+
const interpolatedString = scope ? $interpolate(sourceString)(scope) : sourceString;
|
|
963
|
+
return fallBackToC8yTranslate(translatedString, interpolatedString);
|
|
964
|
+
}
|
|
965
|
+
return sourceString;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* If angular-gettext could not translate the string on its own, it returns the source string.
|
|
969
|
+
* In that case we let the Angular translate service handle it, so that server message patterns
|
|
970
|
+
* are resolved and context indicators (text in backticks) are removed in runtime.
|
|
971
|
+
*/
|
|
972
|
+
function fallBackToC8yTranslate(translatedString, interpolatedString) {
|
|
973
|
+
if (translatedString && translatedString === interpolatedString) {
|
|
974
|
+
return c8yTranslate.instant(interpolatedString);
|
|
975
|
+
}
|
|
976
|
+
return translatedString;
|
|
977
|
+
}
|
|
962
978
|
gettextCatalog.getString = newGetString;
|
|
979
|
+
gettextCatalog.getPlural = newGetPlural;
|
|
963
980
|
return gettextCatalog;
|
|
964
981
|
}
|
|
965
982
|
|