Skip to content
Novus Examples
json1.4 KB

ICU MessageFormat — Apostrophe and brace quoting

The quoting rules that make ICU messages surprising: a single quote starts a literal section only when the next character is one ICU cares about, a doubled '' is always one apostrophe, and '#' inside a plural branch is a literal hash. Every message is paired with the exact string it must produce.

Preview — first 47 linesjson
{
  "locale": "en",
  "format": "icu-messageformat",
  "note": "In ICU MessageFormat, '#' inside a plural branch binds to the NEAREST enclosing plural argument, not the outermost one. Where an outer count must appear inside an inner plural, these messages use the explicit {name} form instead of '#'.",
  "messages": {
    "literalBraces": "'{'not an argument'}' but this is: {value}",
    "apostrophe": "It''s the user''s file",
    "quotedHash": "{count, plural, other {'#' is literal here, # is the number}}",
    "notQuoted": "Percent 50% and a lone apostrophe in a word like don't stay literal",
    "quotedPound": "{count, plural, other {Issue '#'# was filed}}"
  },
  "cases": [
    {
      "message": "literalBraces",
      "args": {
        "value": "42"
      },
      "expected": "{not an argument} but this is: 42"
    },
    {
      "message": "apostrophe",
      "args": {},
      "expected": "It's the user's file"
    },
    {
      "message": "quotedHash",
      "args": {
        "count": 7
      },
      "expected": "# is literal here, 7 is the number"
    },
    {
      "message": "notQuoted",
      "args": {},
      "expected": "Percent 50% and a lone apostrophe in a word like don't stay literal"
    },
    {
      "message": "quotedPound",
      "args": {
        "count": 3
      },
      "expected": "Issue #3 was filed"
    }
  ],
  "feature": "ICU apostrophe and brace quoting"
}

Specifications

Format
ICU MessageFormat
Locale
en
Feature
quoting
Messages
5
Cases
5
Seed
20260807
Wave
p7
Line Endings
LF

Testing contract

Expected to pass
Scenario
Format each message with the arguments given and compare to `expected`.
Expected result
"It''s the user''s file" renders with single apostrophes, "'{'not an argument'}'" renders literal braces, and the lone apostrophe in "don't" survives untouched.

What is a .json file?

JSON (JavaScript Object Notation) is a lightweight, text-based data-interchange format representing objects, arrays, strings, numbers, booleans, and null. It is language-independent, human-readable, and the dominant format for web APIs and configuration. It requires a single well-formed root value.

How to use this file

Use an example JSON file to test parsers and serializers, schema validation, Unicode and number-precision handling, and API request or response processing.

How to use this file for testing

“ICU MessageFormat — Apostrophe and brace quoting” is a deterministic Novus Examples fixture for Internationalization, Localization catalogs, Error handling. Parallel text and accented, multi-script content — for testing translation pipelines, Unicode handling, and localization tooling.

Documented properties for this file: seed 20260807 · 5 messages · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Translation-catalog fixtures carry the same message set across formats, each with its native placeholder syntax. Test your i18n loader, catalog converter, or translation-memory tool, and use the RTL and CJK variants to check bidirectional text and Unicode handling.

Load the catalog with your i18n framework and verify placeholder interpolation and plural handling; the RTL and CJK variants exercise bidirectional text and font fallback.

Code examples

import json

with open("messageformat-quoting.json") as f:
    data = json.load(f)
print(type(data), len(data))

Generated by generation/localization_p7.py. Free for any use, no attribution required — license.