diff --git a/.babelrc b/.babelrc index 3200c2c400024..6b0168a562a93 100644 --- a/.babelrc +++ b/.babelrc @@ -16,7 +16,7 @@ }, "extract": { "plugins": [ - ["c-3po", { + ["ttag", { "extract": { "output": "locales/metabase-frontend.pot" }, diff --git a/bin/i18n/build-translation-frontend-resource b/bin/i18n/build-translation-frontend-resource index 6ac27035b3eb4..a1b5179014e0b 100755 --- a/bin/i18n/build-translation-frontend-resource +++ b/bin/i18n/build-translation-frontend-resource @@ -7,7 +7,7 @@ const fs = require("fs"); const _ = require("underscore"); const gParser = require("gettext-parser"); -// NOTE: this function replace xgettext "{0}" style references with c-3po "${ 0 }" style references +// NOTE: this function replace xgettext "{0}" style references with ttag "${ 0 }" style references function replaceReferences(str) { return str.replace(/\{ *(\d+) *\}/g, "${ $1 }"); } diff --git a/bin/i18n/update-translation-template b/bin/i18n/update-translation-template index fd0873cc0ab6d..ebe2b20a3f5ce 100755 --- a/bin/i18n/update-translation-template +++ b/bin/i18n/update-translation-template @@ -30,7 +30,7 @@ mkdir -p "locales" BABEL_ENV=extract ./node_modules/.bin/babel -q -x .js,.jsx -o /dev/null frontend/src # BABEL_ENV=extract BABEL_DISABLE_CACHE=1 yarn run build -# NOTE: replace c-3po's "${ 0 }" style references with xgettext "{0}" style references for consistency +# NOTE: replace ttag's "${ 0 }" style references with xgettext "{0}" style references for consistency sed -i".bak" -E 's/\$\{ *([0-9]+) *\}/{\1}/g' "$POT_FRONTEND_NAME" rm "$POT_FRONTEND_NAME.bak" diff --git a/docs/developers-guide.md b/docs/developers-guide.md index ca187d40e76b6..01a4e2095038a 100644 --- a/docs/developers-guide.md +++ b/docs/developers-guide.md @@ -307,7 +307,7 @@ We are an application with lots of users all over the world. To help them use Me If you need to add new strings (try to be judicious about adding copy) do the following: -1. Tag strings in the frontend using `t` and `jt` ES6 template literals (see more details in https://c-3po.js.org/): +1. Tag strings in the frontend using `t` and `jt` ES6 template literals (see more details in https://ttag.js.org/): ```javascript const someString = t`Hello ${name}!`; diff --git a/frontend/src/metabase/lib/i18n-debug.js b/frontend/src/metabase/lib/i18n-debug.js index 429e9e4d64b84..0699a6896e49f 100644 --- a/frontend/src/metabase/lib/i18n-debug.js +++ b/frontend/src/metabase/lib/i18n-debug.js @@ -35,7 +35,7 @@ const obfuscateString = (original, string) => { }; export function enableTranslatedStringReplacement() { - const c3po = require("c-3po"); + const c3po = require("ttag"); const _t = c3po.t; const _jt = c3po.jt; const _ngettext = c3po.ngettext; diff --git a/frontend/src/metabase/lib/i18n.js b/frontend/src/metabase/lib/i18n.js index dad98c7269222..eeeee69e44965 100644 --- a/frontend/src/metabase/lib/i18n.js +++ b/frontend/src/metabase/lib/i18n.js @@ -26,7 +26,7 @@ export function setLocalization(translationsObject) { } // we delete msgid property since it's redundant, but have to add it back in to -// make c-3po happy +// make ttag happy function addMsgIds(translationsObject) { const msgs = translationsObject.translations[""]; for (const msgid in msgs) {