Skip to content

Commit

Permalink
misc. clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate committed Jul 17, 2024
1 parent 04673ff commit 3cb8368
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clients/fides-js/__tests__/lib/i18n/i18n-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe("i18n-utils", () => {
});

describe("when loading from a tcf_overlay experience", () => {
it("reads all messages from plus/gvl/translations API response and loads into the i18n catalog", () => {
it("reads all messages from gvl translations API response and loads into the i18n catalog", () => {
// Mock out a partial response for a tcf_overlay including translations
const mockExpWithGVL = JSON.parse(JSON.stringify(mockExperience));
mockExpWithGVL.experience_config.component = "tcf_overlay";
Expand Down
13 changes: 6 additions & 7 deletions clients/fides-js/src/lib/i18n/i18n-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ export function loadMessagesFromExperience(
experienceTranslationOverrides?: Partial<FidesExperienceTranslationOverrides>
) {
const allMessages: Record<Locale, Messages> = {};
const availableLocales: Locale[] = experience.available_locales || [
DEFAULT_LOCALE,
];
const availableLocales: Locale[] = experience.available_locales?.length
? experience.available_locales
: [DEFAULT_LOCALE];

// Extract messages from experience_config.translations
if (experience?.experience_config) {
Expand Down Expand Up @@ -466,10 +466,9 @@ export function initializeI18n(
): void {
// Extract & update all the translated messages from both our static files and the experience API
loadMessagesFromFiles(i18n);
const availableLocales = experience.available_locales || [DEFAULT_LOCALE];
if (availableLocales.length === 0) {
availableLocales.push(DEFAULT_LOCALE);
}
const availableLocales: Locale[] = experience.available_locales?.length
? experience.available_locales
: [DEFAULT_LOCALE];
loadMessagesFromExperience(i18n, experience, experienceTranslationOverrides);
debugLog(
options?.debug,
Expand Down

0 comments on commit 3cb8368

Please sign in to comment.