Repository: freeCodeCamp/freeCodeCamp
File: shared/config/i18n.ts (TypeScript)

Code before:
  [Languages.German]: 'Deutsch',
  [Languages.Arabic]: 'العربية',
  [Languages.Swahili]: 'Swahili',
  [Languages.Korean]: '한국어'
};

/* These are for formatting dates and numbers. Used with JS .toLocaleString().
 * There's an example in profile/components/Camper.js
 * List: https://github.com/unicode-cldr/cldr-dates-modern/tree/master/main
 */
export const LangCodes = {
  [Languages.English]: 'en-US',
  [Languages.Espanol]: 'es-419',
  [Languages.Chinese]: 'zh',
  [Languages.ChineseTraditional]: 'zh-Hant',
  [Languages.Italian]: 'it',
  [Languages.Portuguese]: 'pt-BR',
  [Languages.Ukrainian]: 'uk',
  [Languages.Japanese]: 'ja',
  [Languages.German]: 'de',
  [Languages.Arabic]: 'ar',
  [Languages.Swahili]: 'sw',
  [Languages.Korean]: 'ko'
};

/**
 * This array contains languages that should NOT appear in the language selector.
 */
export const hiddenLangs = [Languages.Arabic];

/**
 * This array contains languages that use the RTL layouts.
 */
export const rtlLangs = [Languages.Arabic];

// locale is sourced from a JSON file, so we use getLangCode to
// find the associated enum values

export function getLangCode(locale: PropertyKey): string {
  if (isPropertyOf(LangCodes, locale)) return LangCodes[locale];
  throw new Error(`${String(locale)} is not a valid locale`);
}

function isPropertyOf<O>(
  obj: Record<string, string>,
  key: PropertyKey
): key is keyof O {
  return Object.prototype.hasOwnProperty.call(obj, key);
}


Review comment (suggestion):
Down on line 116, add `Languages.Korean` to the `hiddenLangs` array.

That'll make this PR safe to merge without blocking deployments. We'll unhide the language once the Korean site itself is live. 

Code after:
  [Languages.German]: 'Deutsch',
  [Languages.Arabic]: 'العربية',
  [Languages.Swahili]: 'Swahili',
  [Languages.Korean]: '한국어'
};

/* These are for formatting dates and numbers. Used with JS .toLocaleString().
 * There's an example in profile/components/Camper.js
 * List: https://github.com/unicode-cldr/cldr-dates-modern/tree/master/main
 */
export const LangCodes = {
  [Languages.English]: 'en-US',
  [Languages.Espanol]: 'es-419',
  [Languages.Chinese]: 'zh',
  [Languages.ChineseTraditional]: 'zh-Hant',
  [Languages.Italian]: 'it',
  [Languages.Portuguese]: 'pt-BR',
  [Languages.Ukrainian]: 'uk',
  [Languages.Japanese]: 'ja',
  [Languages.German]: 'de',
  [Languages.Arabic]: 'ar',
  [Languages.Swahili]: 'sw',
  [Languages.Korean]: 'ko'
};

/**
 * This array contains languages that should NOT appear in the language selector.
 */
export const hiddenLangs = [Languages.Arabic, Languages.Korean];

/**
 * This array contains languages that use the RTL layouts.
 */
export const rtlLangs = [Languages.Arabic];

// locale is sourced from a JSON file, so we use getLangCode to
// find the associated enum values

export function getLangCode(locale: PropertyKey): string {
  if (isPropertyOf(LangCodes, locale)) return LangCodes[locale];
  throw new Error(`${String(locale)} is not a valid locale`);
}

function isPropertyOf<O>(
  obj: Record<string, string>,
  key: PropertyKey
): key is keyof O {
  return Object.prototype.hasOwnProperty.call(obj, key);
}