Maltese Malti

BCP 47 language tag: mt

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

Maltese is most often spoken in Malta.

Cardinalities

  • CARDINALITY_ONE

    Matches n = 1

    Example Integers: 1

    Example Decimals: 1.0, 1.00, 1.000, 1.0000

  • CARDINALITY_TWO

    Matches n = 2

    Example Integers: 2

    Example Decimals: 2.0, 2.00, 2.000, 2.0000

  • CARDINALITY_FEW

    Matches n = 0 or n % 100 = 3..10

    Example Integers: 0, 3, 10, 103, 109, 1003, …

    Example Decimals: 0.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 103.0, 1003.0, …

  • CARDINALITY_MANY

    Matches n % 100 = 11..19

    Example Integers: 11, 19, 111, 117, 1011, …

    Example Decimals: 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 111.0, 1011.0, …

  • CARDINALITY_OTHER

    Matches all other values

    Example Integers: 20, 35, 100, 1000, 10000, 100000, 1000000, …

    Example Decimals: 0.1, 0.9, 1.1, 1.7, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …

Cardinality example

This localized strings example uses complete, page-local CLDR minimal-pair patterns to demonstrate every cardinality category defined for the locale. Minimal-pair text contrasts grammatical forms; it is language-reference data, not reusable application copy.

Source: Unicode CLDR 48.2 mt locale data.

Sample localized strings file
mt.json Localized Strings File (Maltese)
{
  "Cardinality.MinimalPair": {
    "commentary": "Demonstrates every CLDR cardinal category defined for this locale.",
    "translation": "{{cardinalityExample}}",
    "placeholders": {
      "cardinalityExample": {
        "value": "cardinalityValue",
        "translations": {
          "CARDINALITY_ONE": "jum",
          "CARDINALITY_TWO": "jumejn",
          "CARDINALITY_FEW": "{{formattedCardinalityValue}} ijiem",
          "CARDINALITY_MANY": "{{formattedCardinalityValue}}-il jum",
          "CARDINALITY_OTHER": "{{formattedCardinalityValue}} jum"
        }
      }
    }
  }
}
Usage and expected results

JavaScript

The JavaScript code passes each raw number for cardinality selection and formats its display value separately with Intl.NumberFormat.

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

const locale = "mt";

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

const numberFormat = new Intl.NumberFormat(locale);

// Raw numbers select language forms; Intl.NumberFormat produces the display values

// CARDINALITY_ONE
const oneCardinality = 1;
const oneFormattedCardinalityValue = numberFormat.format(oneCardinality);

cardinalityForNumber(oneCardinality, locale).name;   // => "CARDINALITY_ONE"
strings.get("Cardinality.MinimalPair", {
  cardinalityValue: oneCardinality,
  formattedCardinalityValue: oneFormattedCardinalityValue,
});   // => "jum"

// CARDINALITY_TWO
const twoCardinality = 2;
const twoFormattedCardinalityValue = numberFormat.format(twoCardinality);

cardinalityForNumber(twoCardinality, locale).name;   // => "CARDINALITY_TWO"
strings.get("Cardinality.MinimalPair", {
  cardinalityValue: twoCardinality,
  formattedCardinalityValue: twoFormattedCardinalityValue,
});   // => "jumejn"

// CARDINALITY_FEW
const fewCardinality = 0;
const fewFormattedCardinalityValue = numberFormat.format(fewCardinality);

cardinalityForNumber(fewCardinality, locale).name;   // => "CARDINALITY_FEW"
strings.get("Cardinality.MinimalPair", {
  cardinalityValue: fewCardinality,
  formattedCardinalityValue: fewFormattedCardinalityValue,
});   // => "0 ijiem"

// CARDINALITY_MANY
const manyCardinality = 11;
const manyFormattedCardinalityValue = numberFormat.format(manyCardinality);

cardinalityForNumber(manyCardinality, locale).name;   // => "CARDINALITY_MANY"
strings.get("Cardinality.MinimalPair", {
  cardinalityValue: manyCardinality,
  formattedCardinalityValue: manyFormattedCardinalityValue,
});   // => "11-il jum"

// CARDINALITY_OTHER
const otherCardinality = 20;
const otherFormattedCardinalityValue = numberFormat.format(otherCardinality);

cardinalityForNumber(otherCardinality, locale).name;   // => "CARDINALITY_OTHER"
strings.get("Cardinality.MinimalPair", {
  cardinalityValue: otherCardinality,
  formattedCardinalityValue: otherFormattedCardinalityValue,
});   // => "20 jum"

Java

The Java code passes each raw number for cardinality selection and formats its display value separately with NumberFormat.

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

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

NumberFormat numberFormat = NumberFormat.getNumberInstance(locale);

// Raw numbers select language forms; NumberFormat produces the display values

// CARDINALITY_ONE
Number oneCardinality = 1;
String oneFormattedCardinalityValue = numberFormat.format(oneCardinality);

assertEquals(Cardinality.ONE, Cardinality.forNumber(oneCardinality, locale));

assertEquals("jum", strings.get(
  "Cardinality.MinimalPair",
  Map.of("cardinalityValue", oneCardinality, "formattedCardinalityValue", oneFormattedCardinalityValue)
));

// CARDINALITY_TWO
Number twoCardinality = 2;
String twoFormattedCardinalityValue = numberFormat.format(twoCardinality);

assertEquals(Cardinality.TWO, Cardinality.forNumber(twoCardinality, locale));

assertEquals("jumejn", strings.get(
  "Cardinality.MinimalPair",
  Map.of("cardinalityValue", twoCardinality, "formattedCardinalityValue", twoFormattedCardinalityValue)
));

// CARDINALITY_FEW
Number fewCardinality = 0;
String fewFormattedCardinalityValue = numberFormat.format(fewCardinality);

assertEquals(Cardinality.FEW, Cardinality.forNumber(fewCardinality, locale));

// Expected: 0 ijiem
assertEquals(fewFormattedCardinalityValue + " ijiem", strings.get(
  "Cardinality.MinimalPair",
  Map.of("cardinalityValue", fewCardinality, "formattedCardinalityValue", fewFormattedCardinalityValue)
));

// CARDINALITY_MANY
Number manyCardinality = 11;
String manyFormattedCardinalityValue = numberFormat.format(manyCardinality);

assertEquals(Cardinality.MANY, Cardinality.forNumber(manyCardinality, locale));

// Expected: 11-il jum
assertEquals(manyFormattedCardinalityValue + "-il jum", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", manyCardinality,
    "formattedCardinalityValue", manyFormattedCardinalityValue
  )
));

// CARDINALITY_OTHER
Number otherCardinality = 20;
String otherFormattedCardinalityValue = numberFormat.format(otherCardinality);

assertEquals(Cardinality.OTHER, Cardinality.forNumber(otherCardinality, locale));

// Expected: 20 jum
assertEquals(otherFormattedCardinalityValue + " jum", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", otherCardinality,
    "formattedCardinalityValue", otherFormattedCardinalityValue
  )
));

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("mt")
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
))

// CARDINALITY_ONE
let number1 = try NumericValue.forDecimal("1")
let category1 = try Cardinality.forNumber(number1, locale: locale.tag)
assert(category1 == .one)
// This fixed display value makes the translation assertion reproducible.
let display1 = "1"
let message1 = try strings.get("Cardinality.MinimalPair", placeholders: [
  "cardinalityValue": .number(number1),
  "formattedCardinalityValue": .text(display1),
])
assert(ExactString(message1) == ExactString("jum"))

// CARDINALITY_TWO
let number2 = try NumericValue.forDecimal("2")
let category2 = try Cardinality.forNumber(number2, locale: locale.tag)
assert(category2 == .two)
// This fixed display value makes the translation assertion reproducible.
let display2 = "2"
let message2 = try strings.get("Cardinality.MinimalPair", placeholders: [
  "cardinalityValue": .number(number2),
  "formattedCardinalityValue": .text(display2),
])
assert(ExactString(message2) == ExactString("jumejn"))

// CARDINALITY_FEW
let number3 = try NumericValue.forDecimal("0")
let category3 = try Cardinality.forNumber(number3, locale: locale.tag)
assert(category3 == .few)
// This fixed display value makes the translation assertion reproducible.
let display3 = "0"
let message3 = try strings.get("Cardinality.MinimalPair", placeholders: [
  "cardinalityValue": .number(number3),
  "formattedCardinalityValue": .text(display3),
])
assert(ExactString(message3) == ExactString("0 ijiem"))

// CARDINALITY_MANY
let number4 = try NumericValue.forDecimal("11")
let category4 = try Cardinality.forNumber(number4, locale: locale.tag)
assert(category4 == .many)
// This fixed display value makes the translation assertion reproducible.
let display4 = "11"
let message4 = try strings.get("Cardinality.MinimalPair", placeholders: [
  "cardinalityValue": .number(number4),
  "formattedCardinalityValue": .text(display4),
])
assert(ExactString(message4) == ExactString("11-il jum"))

// CARDINALITY_OTHER
let number5 = try NumericValue.forDecimal("20")
let category5 = try Cardinality.forNumber(number5, locale: locale.tag)
assert(category5 == .other)
// This fixed display value makes the translation assertion reproducible.
let display5 = "20"
let message5 = try strings.get("Cardinality.MinimalPair", placeholders: [
  "cardinalityValue": .number(number5),
  "formattedCardinalityValue": .text(display5),
])
assert(ExactString(message5) == ExactString("20 jum"))

Cardinality Ranges

No explicit CLDR cardinality-range mapping is defined for this language, so every range falls back to the ending cardinality.

Ordinalities

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

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