Korean 한국어

BCP 47 language tag: ko

Lokalized supports cardinality, cardinality range, and ordinality rules for Korean.

Additional modeled concepts for Korean: classifiers and counters; formality and register.

Korean is most often spoken in South Korea, North Korea, China, the United States, and Japan.

Cardinalities

All numbers use CARDINALITY_OTHER; no value selects a different form.

Example: 2일.

Cardinality Ranges

Every range resolves to CARDINALITY_OTHER because every endpoint is CARDINALITY_OTHER, so no range can select a different form.

Ordinalities

All ordinal numbers use ORDINALITY_OTHER; no value selects a different form.

Example: 2번째 길목에서 우회전하세요..

Language-Specific Examples

These examples show how Lokalized models grammatical choices and translation behavior that commonly affect Korean application copy. Each example identifies the Lokalized language forms and other library features it uses.

Counters for books and machines

Passing CLASSIFIER_BOUND selects the book noun and 권 counter, while CLASSIFIER_MACHINE selects the computer noun and 대 counter; the application supplies the count separately.

Language references: National Institute of Korean Language - 권 for counting books, National Institute of Korean Language - 대 for counting machines

Language forms used: classifier

Sample localized strings file
ko.json Localized Strings File (Korean)
{
  "I bought {{count}} items.": {
    "translation": "{{object}} {{count}}{{counter}} 샀어요.",
    "placeholders": {
      "object": {
        "value": "classifier",
        "translations": {
          "CLASSIFIER_BOUND": "책을",
          "CLASSIFIER_MACHINE": "컴퓨터를"
        }
      },
      "counter": {
        "value": "classifier",
        "translations": {
          "CLASSIFIER_BOUND": "권",
          "CLASSIFIER_MACHINE": "대"
        }
      }
    }
  }
}
Usage and expected results

JavaScript

import { CLASSIFIER_BOUND, CLASSIFIER_MACHINE, createStrings } from "lokalized";
import { readStringsFromDirectory } from "lokalized/node";

const locale = "ko";

const strings = createStrings({
  localizedStringSupplier: () => readStringsFromDirectory("strings").catalogs,
  fallbackLocale: locale,
  localeSupplier: () => locale,
});

strings.get("I bought {{count}} items.", { count: 3, classifier: CLASSIFIER_BOUND });   // => "책을 3권 샀어요."
strings.get("I bought {{count}} items.", {
  count: 2,
  classifier: CLASSIFIER_MACHINE,
});   // => "컴퓨터를 2대 샀어요."

Java

Locale locale = Locale.forLanguageTag("ko");

Strings strings = Strings.withFallbackLocale(locale)
  .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings")))
  .localeSupplier((matcher) -> matcher.bestMatchFor(locale))
  .build();

assertEquals("책을 3권 샀어요.", strings.get(
  "I bought {{count}} items.", Map.of("count", 3, "classifier", Classifier.BOUND)
));

assertEquals("컴퓨터를 2대 샀어요.", strings.get(
  "I bought {{count}} items.", Map.of("count", 2, "classifier", Classifier.MACHINE)
));

Swift

Swift uses pinned CLDR rules for raw numeric values. The display strings in these assertions are fixed examples; applications format display values separately with Foundation. Default .rtlLocales bidi isolation adds FSI/PDI to interpolated values in right-to-left output.

import Foundation
import Lokalized

let locale = try LocaleTag("ko")
let files = try LocalizedStringLoader.loadFromDirectory(URL(fileURLWithPath: "strings"))
let catalogs = files.mapValues { LocalizedCatalog(strings: $0.strings) }

let strings = try DefaultStrings(configuration: StringsConfiguration(
  localizedStringSupplier: { catalogs }, localeSupplier: { _ in locale },
  fallbackLocale: locale
))

let message1 = try strings.get("I bought {{count}} items.", placeholders: [
  "count": .number(try NumericValue.forDecimal("3")),
  "classifier": .languageForm(.classifier(.bound)),
])
assert(ExactString(message1) == ExactString("책을 3권 샀어요."))

let message2 = try strings.get("I bought {{count}} items.", placeholders: [
  "count": .number(try NumericValue.forDecimal("2")),
  "classifier": .languageForm(.classifier(.machine)),
])
assert(ExactString(message2) == ExactString("컴퓨터를 2대 샀어요."))

Three addressee speech levels

This application maps FORMALITY_CASUAL to unraised 해체, FORMALITY_INFORMAL to polite but nonformal 해요체, and FORMALITY_FORMAL to formal-polite 하십시오체. These are three practical UI choices, not a complete model of Korean honorification or all six addressee speech levels.

Language references: National Institute of Korean Language - addressee honorification and speech levels, National Institute of Korean Language - forms and examples for 고맙다

Language forms used: formality

Sample localized strings file
ko.json Localized Strings File (Korean)
{
  "Thank you.": {
    "translation": "{{thanks}}",
    "placeholders": {
      "thanks": {
        "value": "formality",
        "translations": {
          "FORMALITY_CASUAL": "고마워.",
          "FORMALITY_INFORMAL": "고마워요.",
          "FORMALITY_FORMAL": "고맙습니다."
        }
      }
    }
  }
}
Usage and expected results

JavaScript

import { FORMALITY_CASUAL, FORMALITY_FORMAL, FORMALITY_INFORMAL, createStrings } from "lokalized";
import { readStringsFromDirectory } from "lokalized/node";

const locale = "ko";

const strings = createStrings({
  localizedStringSupplier: () => readStringsFromDirectory("strings").catalogs,
  fallbackLocale: locale,
  localeSupplier: () => locale,
});

strings.get("Thank you.", { formality: FORMALITY_CASUAL });   // => "고마워."
strings.get("Thank you.", { formality: FORMALITY_INFORMAL });   // => "고마워요."
strings.get("Thank you.", { formality: FORMALITY_FORMAL });   // => "고맙습니다."

Java

Locale locale = Locale.forLanguageTag("ko");

Strings strings = Strings.withFallbackLocale(locale)
  .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings")))
  .localeSupplier((matcher) -> matcher.bestMatchFor(locale))
  .build();

assertEquals("고마워.", strings.get(
  "Thank you.", Map.of("formality", Formality.CASUAL)
));

assertEquals("고마워요.", strings.get(
  "Thank you.", Map.of("formality", Formality.INFORMAL)
));

assertEquals("고맙습니다.", strings.get(
  "Thank you.", Map.of("formality", Formality.FORMAL)
));

Swift

Swift uses pinned CLDR rules for raw numeric values. The display strings in these assertions are fixed examples; applications format display values separately with Foundation. Default .rtlLocales bidi isolation adds FSI/PDI to interpolated values in right-to-left output.

import Foundation
import Lokalized

let locale = try LocaleTag("ko")
let files = try LocalizedStringLoader.loadFromDirectory(URL(fileURLWithPath: "strings"))
let catalogs = files.mapValues { LocalizedCatalog(strings: $0.strings) }

let strings = try DefaultStrings(configuration: StringsConfiguration(
  localizedStringSupplier: { catalogs }, localeSupplier: { _ in locale },
  fallbackLocale: locale
))

let message1 = try strings.get("Thank you.", placeholders: [
  "formality": .languageForm(.formality(.casual)),
])
assert(ExactString(message1) == ExactString("고마워."))

let message2 = try strings.get("Thank you.", placeholders: [
  "formality": .languageForm(.formality(.informal)),
])
assert(ExactString(message2) == ExactString("고마워요."))

let message3 = try strings.get("Thank you.", placeholders: [
  "formality": .languageForm(.formality(.formal)),
])
assert(ExactString(message3) == ExactString("고맙습니다."))

Addendum: Language Form Rules

The language form expressions above are specified by Unicode Technical Standard #35 and use the following notation:

  • n absolute value of the source number (integer and decimals)
  • i integer digits of n
  • v number of visible fraction digits in n, with trailing zeros
  • w number of visible fraction digits in n, without trailing zeros
  • f visible fractional digits in n, with trailing zeros
  • t visible fractional digits in n, without trailing zeros
  • c/e compact decimal exponent operands used by some CLDR compact-number rules