mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Revert "Ensure client-side translations are correctly extracted into the message templates."
This reverts commit 82bd97aed0.
There are still issues extracting with these changes.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
define(["translations"], function (translations) {
|
||||
|
||||
/***
|
||||
* This method behaves as a drop-in replacement for flask translation rendering.
|
||||
* It uses the same translation file under the hood and uses flask to determine the language.
|
||||
*
|
||||
* ex. translate("some %(adjective)s text", {adjective: "cool"})
|
||||
*
|
||||
* @param {String} text
|
||||
* @param {Object} substitutions
|
||||
*/
|
||||
return function gettext(text, substitutions) {
|
||||
|
||||
var rawTranslation = translations[text] ? translations[text] : text;
|
||||
|
||||
// captures things of the form %(substitutionName)s
|
||||
var substitutionGroupsRegExp = /([^%]*)%\(([^\)]+)\)s(.*)/;
|
||||
var matchFound;
|
||||
|
||||
var interpolated = rawTranslation;
|
||||
do {
|
||||
matchFound = false;
|
||||
interpolated = interpolated.replace(substitutionGroupsRegExp, function (_, textBeginning, substitutionName, textEnd) {
|
||||
matchFound = true;
|
||||
return textBeginning + substitutions[substitutionName] + textEnd;
|
||||
});
|
||||
} while (matchFound);
|
||||
|
||||
return interpolated;
|
||||
};
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user