Skip to content
Novus Examples
json4.8 KB

Locale Date and Time Patterns — with the four classic traps (JSON)

The structured date table plus the four traps worth their own test: day/month ambiguity in short dates, the RLM embedded in CLDR's Arabic pattern, quoted literal text inside the Russian pattern, and the localized day-period marker that a 12-hour formatter must not drop.

Preview — first 50 linesjson
{
  "note": "Assert on the pattern, the separator code points and the fraction-digit counts. The rendered example strings are illustrative: CLDR revises month abbreviations and spacing between releases, so a byte comparison against them will eventually fail for reasons that are not your bug.",
  "instant": "2026-03-14T09:05:00",
  "iso8601": "2026-03-14T09:05:00Z",
  "locales": [
    {
      "locale": "en-US",
      "patterns": {
        "shortDate": "M/d/yy",
        "mediumDate": "MMM d, y",
        "shortTime": "h:mm a"
      },
      "hourCycle": "h12",
      "examples": {
        "shortDate": "3/14/26",
        "mediumDate": "Mar 14, 2026",
        "shortTime": "9:05 AM"
      }
    },
    {
      "locale": "en-GB",
      "patterns": {
        "shortDate": "dd/MM/y",
        "mediumDate": "d MMM y",
        "shortTime": "HH:mm"
      },
      "hourCycle": "h23",
      "examples": {
        "shortDate": "14/03/2026",
        "mediumDate": "14 Mar 2026",
        "shortTime": "09:05"
      }
    },
    {
      "locale": "de-DE",
      "patterns": {
        "shortDate": "dd.MM.yy",
        "mediumDate": "dd.MM.y",
        "shortTime": "HH:mm"
      },
      "hourCycle": "h23",
      "examples": {
        "shortDate": "14.03.26",
        "mediumDate": "14.03.2026",
        "shortTime": "09:05"
      }
    },
    {
      "locale": "fr-FR",
      "patterns": {
170 lines total — download for the full file.

Specifications

Locales
10
Traps
4
Instant
2026-03-14T09:05:00
Assert On
patterns, not rendered prose
Hour Cycles
h12, h23
Seed
20260807
Wave
p7
Line Endings
LF

Testing contract

Reference control
Scenario
Drive an Intl.DateTimeFormat / ICU comparison from the `locales` array and assert each entry in `traps` on its own.
Expected result
03/04/2026 parses to two different dates under en-GB and en-US, and a formatter that treats every letter in a pattern as a field turns ru-RU's quoted 'г'. into date fields.

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

“Locale Date and Time Patterns — with the four classic traps (JSON)” is a deterministic Novus Examples fixture for Internationalization, JSON parsing, Localization catalogs. Parallel text and accented, multi-script content — for testing translation pipelines, Unicode handling, and localization tooling.

Documented properties for this file: seed 20260807 · 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("date-time-formats.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.