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.
{
"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))Related files
- xmlAndroid strings.xml — escaping, xliff:g and markup rulesEvery escaping rule aapt2 enforces on a strings.xml, in one file: backslash-escaped apostrophes and quotes, quoted values that preserve leading whitespace, an escaped @ and ?, CDATA-wrapped inline HTML, <xliff:g> placeholder protection with examples, formatted="false", translatable="false" and a scoped tools:ignore.

- pogettext PO — fuzzy, obsolete and untranslated entriesA German catalog carrying every state a PO entry can be in but the happy one: two fuzzy entries (one of them a plural) with #| previous-msgid comments, an entry that is present but untranslated, three obsolete #~ entries including an obsolete plural and an obsolete msgctxt entry, and two complete entries as the control.

- jsonICU MessageFormat — Nested select/plural (Arabic)Arabic ICU MessageFormat catalog whose messages nest a select inside a plural branch and a plural inside a select branch, shipped with the argument bindings and the exact output each one must produce. Includes the '#' binding trap: inside a nested plural, '#' refers to the inner argument, so the outer count is written explicitly.

- jsonICU MessageFormat — Nested select/plural (English)English ICU MessageFormat catalog whose messages nest a select inside a plural branch and a plural inside a select branch, shipped with the argument bindings and the exact output each one must produce. Includes the '#' binding trap: inside a nested plural, '#' refers to the inner argument, so the outer count is written explicitly.

- jsonICU MessageFormat — Nested select/plural (Polish)Polish ICU MessageFormat catalog whose messages nest a select inside a plural branch and a plural inside a select branch, shipped with the argument bindings and the exact output each one must produce. Includes the '#' binding trap: inside a nested plural, '#' refers to the inner argument, so the outer count is written explicitly.

- jsonICU MessageFormat — Plural offset (English)The 'Rana and 5 others like this' pattern: ICU plural arguments with offset:1 and offset:2, where the explicit =0/=1/=2 selectors match the RAW value but '#' prints the value MINUS the offset. Ships every boundary case with its expected output.

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