Skip to content
Novus Examples
xml1.4 KB

Android <plurals> — English (2 quantities)

English Android quantity strings: 4 <plurals> blocks with an <item> for each of the 2 CLDR quantities en actually selects. Rename to plurals.xml and drop into res/values/ to use it as-is.

Preview — first 33 linesxml
<?xml version="1.0" encoding="utf-8"?>
<!-- Novus example app - English (en) quantity strings.
     Install at res/values/plurals.xml.

     Android resolves <plurals> through the CLDR rules for the resource folder's locale,
     NOT through the numbers in the item text: getQuantityString(R.plurals.files, 2)
     returns the "few" item in values-pl/ and the "other" item in values/. A quantity
     the locale never selects is legal and simply dead — English never selects "zero",
     "two", "few" or "many", which is why the default folder below carries only two items.
     Categories used by en: one, other. -->
<resources>
    <!-- Item count in the status bar -->
    <plurals name="files">
        <item quantity="one">%1$d file</item>
        <item quantity="other">%1$d files</item>
    </plurals>
    <!-- Selection summary -->
    <plurals name="folders_selected">
        <item quantity="one">%1$d folder selected</item>
        <item quantity="other">%1$d folders selected</item>
    </plurals>
    <!-- Undo toast after a delete -->
    <plurals name="deleted_items">
        <item quantity="one">Deleted %1$d item</item>
        <item quantity="other">Deleted %1$d items</item>
    </plurals>
    <!-- Demo string chosen to show Welsh consonant mutation -->
    <plurals name="cats">
        <item quantity="one">%1$d cat</item>
        <item quantity="other">%1$d cats</item>
    </plurals>
</resources>

Specifications

Format
Android string resources
Locale
en
Resource Directory
res/values/
Canonical Name
plurals.xml
Plurals Blocks
4
Quantities
one, other
Placeholder
%1$d (positional)
Seed
20260807
Wave
p7
Line Endings
LF

Testing contract

Expected to pass
Scenario
Call getQuantityString() with counts spanning every category and compare against the en CLDR rules.
Expected result
Android picks the item by the resource folder's CLDR rules, not by the digits in the text: the same count maps to different quantities in different folders, and a quantity the locale never selects is dead resource rather than an error.

What is a .xml file?

XML (Extensible Markup Language) is a verbose, self-describing markup language using nested tags, attributes, and namespaces to represent structured, hierarchical data. It supports schemas, entities, and validation and underlies many document and data formats. It remains common in enterprise, publishing, and interchange contexts.

How to use this file

Use an example XML file to test parsers, namespace and schema validation, XPath queries, and protection against entity-expansion and external-entity attacks.

How to use this file for testing

“Android <plurals> — English (2 quantities)” is a deterministic Novus Examples fixture for Internationalization, 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 · placeholder %1$d (positional). 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 xml.etree.ElementTree as ET

tree = ET.parse("plurals-en.xml")
root = tree.getroot()
print(root.tag, [c.tag for c in root][:5])

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