Easy way to check strings that are in the new system

This commit is contained in:
Brandon Thomas committed 2022-07-29 01:30:51 -04:00
1 parent d3f9422901
commit 89a6c44c49
4 files changed
+30 -7

No files matched your search

@@ -110,5 +110,22 @@ function MergeDeepDictionary(dictA: DeepDictionary, dictB: DeepDictionary) : Dee
return output;
}
// Modify all the string leaves of a dictionary to include a prefix string
// This is useful to test if translations were updated using i18next.
function DebugPrefixLeaves(obj: DeepDictionary, prefix: string) : DeepDictionary {
let output : DeepDictionary = {};
export { COMMON_TRANSLATIONS, MergeDeepDictionary }
Object.keys(obj).forEach((key : string) => {
const value = obj[key];
if (typeof value === 'string') {
output[key] = `${prefix}${value}`;
} else {
output[key] = DebugPrefixLeaves(value, prefix);
}
});
return output;
}
export { COMMON_TRANSLATIONS, MergeDeepDictionary, DebugPrefixLeaves }
@@ -1,4 +1,4 @@
import { COMMON_TRANSLATIONS, MergeDeepDictionary } from '@storyteller/components/src/_i18n/CommonTranslations';
import { COMMON_TRANSLATIONS, DebugPrefixLeaves, MergeDeepDictionary } from '@storyteller/components/src/_i18n/CommonTranslations';
// Use \u{00a0} =   character literal
@@ -7,11 +7,13 @@ import { COMMON_TRANSLATIONS, MergeDeepDictionary } from '@storyteller/component
import * as en from './locales/en';
import * as es from './locales/es';
const NEW_TRANSLATIONS: any = {
let NEW_TRANSLATIONS: any = {
en: { translation: en },
es: { translation: es },
}
NEW_TRANSLATIONS = DebugPrefixLeaves(NEW_TRANSLATIONS, '\u{2705} ');
// NB: These are the old translations. They should be phased out.
const FAKEYOU_TRANSLATIONS: any = {
// English: 46.6% Twitch (#1), 30+% FakeYou (#1)
@@ -1,4 +1,8 @@
{
"heroSubtitle": "Use <strong>FakeYou</strong> deep fake tech to say stuff with your favorite characters*",
"heroTitle": "Text to Speech*"
"heroButtons": {
"cloneVoice": "Clone My Voice!",
"signUp": "Sign Up"
},
"heroSubtitle": "Use <strong>FakeYou</strong> deep fake tech to say stuff with your favorite characters",
"heroTitle": "Text to Speech"
}
@@ -1,4 +1,4 @@
{
"heroSubtitle": "Usa <strong>FakeYou</strong> tecnología falsa profunda para decir cosas con tus personajes favoritos*",
"heroTitle": "Texto a Voz*"
"heroSubtitle": "Usa <strong>FakeYou</strong> tecnología falsa profunda para decir cosas con tus personajes favoritos",
"heroTitle": "Texto a Voz"
}