Installation#
npm i -D @formatjs/cli
Add the following command to your package.json scripts:
{
"scripts": {
"extract": "formatjs extract",
"compile": "formatjs compile"
}
}
Native bindings in the npm CLI#
@formatjs/cli and @formatjs/cli-lib are Node.js packages. Message
extraction runs in Node.js, but formatjs compile, formatjs compile-folder,
and the compile API from @formatjs/cli-lib use native Rust bindings.
There is no JavaScript compiler fallback and no flag to force non-native
compilation. If a native binding is unavailable for the current OS/CPU, or if
your package manager omits optional dependencies, compilation fails with
Native @formatjs/cli-lib binding is unavailable.
The npm packages currently ship native bindings for:
| Platform | Package |
|---|---|
| macOS Apple Silicon | @formatjs/cli-native-darwin-arm64 |
| macOS Intel | @formatjs/cli-native-darwin-x64 |
| Linux arm64 (glibc) | @formatjs/cli-native-linux-arm64 |
| Linux arm64 (musl) | @formatjs/cli-native-linux-arm64-musl |
| Linux x64 (glibc) | @formatjs/cli-native-linux-x64 |
| Linux x64 (musl) | @formatjs/cli-native-linux-x64-musl |
| Windows x64 | @formatjs/cli-native-win32-x64 |
| Windows arm64 | @formatjs/cli-native-win32-arm64 |
The Vite plugin also uses these bindings to evaluate non-literal message fields. Keep optional dependencies enabled so the matching OS/CPU package is installed.
Native CLI (Rust)#
20x Faster Extraction
We provide a high-performance native Rust CLI that's 20.90x faster than the Node.js version in the checked-in extraction benchmark. It is useful for CI/CD pipelines and large JavaScript/TypeScript codebases that do not need Node.js-specific CLI features.
Install it from Cargo with cargo install formatjs_cli, or download a pre-built binary from GitHub Releases. Building from source requires Rust 1.97 or newer.
Caution
The native CLI is not a full drop-in replacement for every @formatjs/cli
feature. It currently focuses on JavaScript/TypeScript with JSX/TSX,
supports built-in formatters only, and does not load custom JavaScript
formatter files. If you need Vue, Svelte, Glimmer, Handlebars, GTS/GJS, or
custom formatter support, use the npm CLI above. Its compilation commands
still require one of the npm native bindings listed above.
Installation#
Install from Cargo:
cargo install formatjs_cli
formatjs --version
Cargo installs the formatjs command into ~/.cargo/bin. If your shell cannot
find it, add Cargo's bin directory to your PATH:
export PATH="$HOME/.cargo/bin:$PATH"
You can also download pre-built binaries for your platform:
# Download and install
curl -L https://github.com/formatjs/formatjs/releases/download/<version>/formatjs_cli-darwin-arm64 -o formatjs
chmod +x formatjs
sudo mv formatjs /usr/local/bin/
# Verify
formatjs --version
Benefits#
- 20.90x Faster Extraction: Dramatically faster extraction in the checked-in Rust vs TypeScript CLI benchmark
- No Node.js Runtime for Supported Features: Single binary, no Node.js runtime required
- Low Memory: Minimal memory footprint
- Instant Startup: No Node.js initialization overhead
- CI/CD Friendly: Useful for build pipelines and automation
Usage#
The native CLI uses the same formatjs command name for supported workflows:
# Extract messages
formatjs extract "src/**/*.{ts,tsx}" --out-file messages.json
# Compile translations
formatjs compile "lang/*.json" --out-file compiled.json --ast
# Verify translations
formatjs verify "lang/*.json" --source-locale en --missing-keys
JavaScript and TypeScript extraction accepts inline message descriptors wrapped
in parentheses, as, satisfies, non-null assertions, and angle-bracket
assertions. This includes defineMessages maps and their entries. Descriptor
keys such as defaultMessage, description, and id may be quoted strings.
The native CLI also extracts formatjs_intl::message_descriptor! calls from
Rust source:
const GREETING: formatjs_intl::MessageDescriptor =
formatjs_intl::message_descriptor!(
default_message: "Hello, {name}!",
description: "Greeting shown after sign-in"
);
formatjs extract "src/**/*.rs" --out-file messages.json
Missing Rust descriptor IDs use [sha512:contenthash:base64:10], matching the
ID generated by message_descriptor! at compile time.
The native CLI parallelizes per-file work with Rayon. By default, Rayon uses the
available logical CPU count. Set RAYON_NUM_THREADS to cap worker threads in
CPU-constrained environments:
RAYON_NUM_THREADS=4 formatjs extract "src/**/*.{ts,tsx}" --out-file messages.json
Most common extraction, compilation, and verification options work with the native CLI. Notable differences from the Node.js CLI:
--formataccepts built-in formatter names only:default,simple,transifex,smartling,lokalise, orcrowdin.- Custom JavaScript formatter files for
compileandcompile-folderare deprecated in the Node.js CLI and are not supported by the standalone native CLI. - Framework template extraction for Vue, Svelte, Handlebars, Glimmer, GTS, and GJS is only supported by the Node.js CLI.
We've built this CLI that helps you extract messages from a list of files. It uses @formatjs/ts-transformer under the hood and should be able to extract messages if you're declaring using 1 of the mechanisms below:
defineMessages({
foo: {
id: 'foo',
defaultMessage: 'foo',
description: 'bar',
},
})
defineMessage({
id: 'single',
defaultMessage: 'single message',
description: 'header',
})
<FormattedMessage id="foo" defaultMessage="foo" description="bar" />
function Comp(props) {
const {intl} = props
return intl.formatMessage({
// The whole `intl.formatMessage` is required so we can extract
id: 'foo',
defaultMessage: 'foo',
description: 'bar',
})
}
Extraction#
npm run extract -- --help
# Usage: formatjs extract [options] [files...]
# Extract string messages from React components that use react-intl.
# The input language is expected to be TypeScript or ES2017 with JSX.
For example:
npm run extract -- "src/**/*.{ts,tsx,vue,svelte}" --out-file lang.json
Caution
You should always quote (" or ') your glob pattern (like "src/**/*") to
avoid auto shell expansion of those glob, which varies depending on your shell
(zsh vs fish vs bash).
--format [path]#
Path to a formatter file that controls the shape of JSON file from --out-file.
The formatter file must export a function called format with the signature.
type FormatFn = <T = Record<string, MessageDescriptor>>(
msgs: Record<string, MessageDescriptor>
) => T
This is especially useful to convert from our extracted format to a TMS-specific format.
See our builtin formatters for examples.
--in-file [path]#
The file containing list of file paths to extract. This is useful to bypass bash command line limit.
--out-file [path]#
The target file path where the plugin will output an aggregated .json file of allthe translations from the files supplied. This flag will ignore --messages-dir
--id-interpolation-pattern [pattern]#
If certain message descriptors don't have id, this pattern will be used to automatically generate IDs for them. Default to [sha512:contenthash:base64:6]. See nodejs crypto createHash for hash algorithms & nodejs buffer docs for digest encodings.
An empty string description generates the same ID as an omitted description. The extracted catalog still preserves description: "".
Use [content] to insert the unhashed content instead of a hash: the default message, followed by # and the description when one is present. For example, --id-interpolation-pattern '[content]' uses each default message as its own ID. Placeholders are expanded in a single pass, so bracketed text inside a message or file path is kept as is.
--extract-source-location#
Whether the metadata about the location of the message in the source file should be extracted. If true, then file, start, and end fields will exist for each extracted message descriptors. (default: false)
--additional-component-names [comma-separated-names]#
Additional component names to extract messages from, e.g: CustomButton,TranslatableText.
This option is useful for creating wrapper components that have react-intl functionality built in. For example, if you have a custom button component that internally uses formatMessage:
// Your wrapper component - must accept same props as FormattedMessage
function CustomButton({id, defaultMessage, description, values, onClick}) {
const intl = useIntl()
return (
<button onClick={onClick}>
{intl.formatMessage({id, defaultMessage, description}, values)}
</button>
)
}
// Usage - this will be extracted when using --additional-component-names
;<CustomButton
defaultMessage="Click me"
description="Button text"
onClick={handleClick}
/>
Usage:
formatjs extract "src/**/*.{ts,tsx}" \
--out-file messages.json \
--additional-component-names CustomButton,TranslatableText
NOTE: By default we check for the fact that FormattedMessage is imported from moduleSourceName to make sure variable alias works. This option does not do that so it's less safe - any component with the specified name will be processed regardless of where it's imported from.
For a complete guide on creating wrapper components with auto ID generation, see the Wrapper Components Guide.
--additional-function-names [comma-separated-names]#
Additional function names to extract messages from, e.g: t,$formatMessage.
This option is useful when you want to create custom function wrappers around formatMessage, or use shorter aliases. For example:
// Custom translation hook - wrapper must match formatMessage signature
function useTranslation() {
const intl = useIntl()
const t = (descriptor, values) => intl.formatMessage(descriptor, values)
return {t}
}
// Usage - this will be extracted when using --additional-function-names
function MyComponent() {
const {t} = useTranslation()
return (
<div>{t({defaultMessage: 'Hello world', description: 'Greeting'})}</div>
)
}
Usage:
formatjs extract "src/**/*.{ts,tsx}" \
--out-file messages.json \
--additional-function-names t,$formatMessage
For a complete guide on creating function wrappers with auto ID generation, see the Wrapper Components Guide.
--ignore [files]#
List of glob paths to not extract translations from.
--throws#
Whether to throw an exception when we fail to resolve, traverse, or process any file in the batch.
Both CLIs always fail on input read errors, including EMFILE, and leave
an existing output catalog unchanged. --throws also makes message-processing
errors fatal. Without it, valid messages from readable files are retained.
Node.js extraction bounds concurrent file reads to the available CPU count,
matching Rayon's default. Set RAYON_NUM_THREADS to a positive integer to
override this limit; zero or invalid values use the default.
--pragma [pragma]#
Parse specific additional custom pragma. This allows you to tag certain file with metadata such as project. For example with this file:
// @intl-meta project:my-custom-project
<FormattedMessage defaultMessage="foo" id="bar" />
and with option {pragma: "intl-meta"}, we'll parse out // @intl-meta project:my-custom-project into {project: 'my-custom-project'} in the result file.
--preserve-whitespace#
Whether to preserve whitespace and newlines in output. We typically remove consecutive whitespaces and newlines since those often gets abused for styling purposes.
--flatten#
Whether to hoist selectors & flatten sentences as much as possible. E.g:
Plural # scope and offsets are preserved. Some selectors stay nested when
hoisting them would change the number printed by #.
I have {count, plural, one{a dog} other{many dogs}}
becomes
{count, plural, one{I have a dog} other{I have many dogs}}
The goal is to provide as many full sentences as possible since fragmented sentences are not translator-friendly.
Verification#
Verify translation files to make sure keys are translated and messages are structurally compatible with source locale.
npm run formatjs verify [options] <translationFiles>
--source-locale <sourceLocale>#
The source locale used for comparison. Per-locale JSON requires a matching
<sourceLocale>.json file. Apple mode infers it from each catalog's
sourceLanguage; an explicit value must match.
--missing-keys#
Check missing keys in known target locales. This does not inspect translation state or determine whether text was translated.
--structural-equality#
Whether to check for structural equality of messages between source and target locale. This makes sure translations are formattable and are not missing any tokens.
--message-syntax <syntax>#
Select icu (default), java-printf, or apple-printf for
--structural-equality. Both npm CLI and Rust binary share the Rust printf
validators.
formatjs verify "lang/*.json" --source-locale en \
--message-syntax java-printf --structural-equality --missing-keys --extra-keys
Java printf verification rejects malformed syntax in source or target messages,
missing/extra resolved argument indices, and changed argument requirements.
For example, %s %d and %2$d %1$s %<s match; %1$d fails for both an
incompatible first argument and a missing second argument. Diagnostics include
locale and message ID.
The set of conversion requirements for each argument must match. Reordering,
repeated references, uppercase variants and compatible numeric/date presentation
changes are allowed. String, boolean, hash, character, integer, floating-point
and date/time uses remain distinct. %#s, signed octal/hexadecimal flags and
hexadecimal floats carry narrower requirements. Runtime Java types/values and
date fields are not inferred.
Input stays JSON with string leaves, optionally nested. This mode does not read
Android XML: decode resource XML, skip formatted="false", and emit each plural
or array item as an independently formatted message before verification.
Apple mode accepts Xcode .xcstrings catalogs and native .strings / .stringsdict resources:
formatjs verify "Resources/**/*.xcstrings" \
--message-syntax apple-printf --structural-equality --missing-keys
Each file contains its own locales. Source language comes from sourceLanguage;
optional --source-locale must match it. Source values use an explicit source
localization when available, otherwise the string key. Catalog paths keep keys
in separate string tables independent.
Validation covers nested device/plural variants and named substitutions.
%#@name@ resolves through its substitution's argNum and formatSpecifier;
%arg inside a branch uses that argument. Locale plural categories may differ,
and selector placeholders may be omitted. Other placeholders must survive in
each applicable branch or its enclosing text.
Object (%@), byte-string (%s), UTF-16 (%C, %S), pointer, integer
signedness/length, floating-point and dynamic width/precision requirements stay
distinct. Reordering and reuse work; %ld becoming %d or %@ becoming %s
fails. Equal ABI sizes do not make distinct declared types interchangeable.
--missing-keys checks known target locales across all supplied catalogs,
skipping shouldTranslate: false. Target locales are inferred from catalog
localizations. --extra-keys adds no checks because a catalog already shares one
key set across locales. Translation-state metadata is not a completeness check.
Catalogs do not carry an explicit formatting flag. Source argument specifiers or substitution metadata identify formatted messages; plain percentages remain literal. A percent followed by a space alone does not establish formatting intent. This inference cannot distinguish every literal from a format string.
Versions 1.0 and 1.1 are accepted. Ambiguous root plural selectors with multiple
numeric arguments, nested named substitutions, unknown variation axes, %n and
logging privacy syntax are rejected for formatted messages. Flat JSON is unsupported
in Apple mode. Verification reads catalogs without changing metadata or translation state.
For native resource files:
formatjs verify 'Resources/**/*.strings*' --source-locale en \
--message-syntax apple-printf --structural-equality --missing-keys --extra-keys
Native files use <locale>.lproj directories and require --source-locale.
Keys are scoped by resource directory and table name; .strings and .stringsdict
for one table are verified together. Plural entries override matching plain fallbacks,
as in Foundation. Duplicate keys within a file are errors.
Missing/extra keys are checked against that table's source locale, including empty
locale files. Other tables' locales do not create missing-key requirements.
Text resources support UTF-8 with optional BOM and BOM-marked UTF-16, quoted and
bare strings, comments, Unicode/octal escapes, and XML plist dictionaries.
The parser preserves descriptions and rejects duplicate fields and malformed input.
Plural rules require NSStringPluralRuleType, an argument type, named format
references, and other. Argument ownership is checked with the existing Apple
printf verifier. Binary plists and non-plural stringsdict rules are unsupported.
See Apple printf parser.
--extra-keys#
Whether to check for keys that exist in the target locale but not in the source locale. This ensures that translation files do not contain obsolete or unused keys.
Compilation#
Compile extracted files from formatjs extract to a react-intl consumable
JSON file. This also does ICU message verification. See Message Distribution for more details.
npm run compile -- --help
--format <name-or-path>#
Built-in formatter name that converts <translation_file> to Record<string, string> so we can compile. Built-in formatter names are default, simple, transifex, smartling, lokalise, and crowdin.
Passing a custom formatter file path is deprecated and prints a warning. The file must export a function named compile with the signature:
type CompileFn = <T = Record<string, MessageDescriptor>>(
msgs: T
) => Record<string, string>
This was historically useful to convert from a TMS-specific format back to react-intl format. Prefer a built-in formatter name or pre-process translation files before running formatjs compile.
See our builtin formatters for examples.
--out-file <output>#
The target file that contains compiled messages.
--ast#
Whether to compile message into AST instead of just string. See Advanced Usage
--pseudo-locale <pseudoLocale>#
Whether we should compile messages into pseudo locales instead. Available pseudo-locales:
Given the English message my name is {name}
| Locale | Message |
|---|---|
xx-LS | my name is {name}SSSSSSSSSSSSSSSSSSSSSSSSS |
xx-AC | MY NAME IS {name} |
xx-HA | [javascript]my name is {name} |
en-XA | [ḿẏ ƞȧȧḿḗḗ īş {name}] |
en-XB | ɯʎ uɐɯǝ ıs {name} |
Caution
--astExtraction and compilation with a single script#
In some environments you may want to simply extract your messages to a file ready for use with react-intl without using an intermediary extracted message file format. This could be useful for quickly and easily creating the file for the original language that uses the default messages. This could also be useful if you use a Translation Management System (TMS) that is best suited to working with the compiled files. Keep in mind that the compiled file does not contain message descriptions so it is harder to work with for translators. Ideally you want to find or write a custom formatter you can use to extract messages into a file format that works with your TMS.
In order to achieve extraction and compilation in a single script, you can simply set up a script for that in package.json like in this example:
"scripts": {
"extract": "formatjs extract",
"compile": "formatjs compile",
"extract-compile": "formatjs extract 'src/**/*.ts*' --out-file temp.json --flatten --id-interpolation-pattern '[sha512:contenthash:base64:6]' && formatjs compile 'temp.json' --out-file lang/en.json && rm temp.json"
}
Breakdown of the script#
The extract-compile example script consists of three operations performed one after the other.
formatjs extract 'src/**/*.ts*' --out-file temp.json --flatten --id-interpolation-pattern '[sha512:contenthash:base64:6]'
The first script extracts messages from all typescript files that are located in subfolders of src. You may need to ignore certain files that could trigger errors or warnings in the script, such as --ignore myFolder/myFile.ts
formatjs compile 'temp.json' --out-file lang/en.json
The second script compiles the messages from temp.json into the file lang/en.json. This file is ready to be consumed by react-intl.
rm temp.json
The last script deletes the temp.json extracted file. Feel free remove this from the script if you wish to keep this file around.
The resulting files#
Here you can see the difference between the extracted (using the default formatter) and the compiled file formats. In the script above, temp.json is the extracted file and en.json is the compiled file.
{
"hak27d": {
"defaultMessage": "Control Panel",
"description": "title of control panel section"
},
"haqsd": {
"defaultMessage": "Delete user {name}",
"description": "delete button"
},
"19hjs": {
"defaultMessage": "New Password",
"description": "placeholder text"
},
"explicit-id": {
"defaultMessage": "Confirm Password",
"description": "placeholder text"
}
}
Folder Compilation#
Batch compile a folder with extracted files from formatjs extract to a folder containing react-intl consumable JSON files. This also does ICU message verification. See Message Distribution for more details.
npm run formatjs compile-folder [options] <folder> <outFolder>
Folder structure should be in the form of <folder>/<locale>.json and the output would be <outFolder>/<locale>.json.
--format <name-or-path>#
Built-in formatter name that converts JSON files in <folder> to Record<string, string> so we can compile. Built-in formatter names are default, simple, transifex, smartling, lokalise, and crowdin.
Passing a custom formatter file path is deprecated and prints a warning. The file must export a function named compile with the signature:
type CompileFn = <T = Record<string, MessageDescriptor>>(
msgs: T
) => Record<string, string>
This was historically useful to convert from a TMS-specific format back to react-intl format. Prefer a built-in formatter name or pre-process translation files before running formatjs compile-folder.
--ast#
Whether to compile message into AST instead of just string. See Advanced Usage
--skip-errors#
Whether to continue compiling messages after encountering an error parsing one of them. Any keys with errors will not be included in the output file.
Builtin Formatters#
We provide the following built-in formatters to integrate with 3rd party TMSes:
| TMS | --format |
|---|---|
| BabelEdit | simple |
| Crowdin Chrome JSON | crowdin |
| Lingohub | simple |
| Localize's Simple JSON | simple |
| Localizely | simple |
| locize | simple |
| Lokalise Structured JSON | lokalise |
| Phrase | simple |
| POEditor Key-Value JSON | simple |
| SimpleLocalize | simple |
| Smartling ICU JSON | smartling |
| Transifex's Structured JSON | transifex |
Caution
The formats of extract & compile have to be the same, which means if you
extract --format smartling, you have to compile --format smartling as well
& vice versa.
Custom Formatters#
Custom formatter files for compilation are deprecated and will be removed in a
future release. They still work in the Node.js CLI for now, but formatjs compile and formatjs compile-folder print a warning when a formatter file
path is passed to --format. Prefer the built-in formatter names above or
pre-process translation files before compilation.
For extraction, or while deprecated compilation formatter-file support remains, you can provide your own formatter by using our interfaces:
interface VendorJson {}
// [Optional] Format @formatjs/cli structure to vendor's structure
export const format: FormatFn<VendorJson> = () => {}
// [Optional] Format vendor's structure to @formatjs/cli structure
export const compile: CompileFn<VendorJson> = () => {}
// [Optional] Sort the messages in a specific order during serialization
export const compareMessages: Comparator = () => {}
Take a look at our builtin formatter code for some examples.
Node API#
Install @formatjs/cli-lib instead to use programmatically
Caution
The compile and compileAndWrite APIs have the same native binding
requirement as formatjs compile. The extract and extractAndWrite APIs do
not require the native binding.
npm i -D @formatjs/cli-lib
Extraction#
const resultAsString: Promise<string> = extract(files, {
idInterpolationPattern: '[sha512:contenthash:base64:6]',
})
Compilation#
const resultAsString: Promise<string> = compile(files, {
ast: true,
})
Custom Formatter#
export const format: FormatFn = msgs => msgs
// Sort key reverse alphabetically
export const compareMessages = (el1, el2) => {
return el1.key < el2.key ? 1 : -1
}
export const compile: CompileFn = msgs => {
const results: Record<string, string> = {}
for (const k in msgs) {
results[k] = msgs[k].defaultMessage!
}
return results
}
Android resource verification#
formatjs verify 'app/src/main/res/**/*.xml' \
--message-syntax android --source-locale en \
--structural-equality --missing-keys --extra-keys
Both Rust and npm CLIs use the same Rust Android resource parser. It reads UTF-8
<resources> XML containing strings, string arrays and plurals. Resources are
grouped by their res directory, regardless of XML filename. values supplies
--source-locale; localized folders support values-fr, values-pt-rBR and
values-b+sr+Latn. Legacy iw, in and ji normalize to he, id and yi.
Additional configuration qualifiers such as values-fr-night are rejected;
verify separate configurations independently. Files from separate source sets
are separate catalogs, without Android overlay resolution.
XML entities (including declared internal entities) decode before Android quotes,
backslash escapes and whitespace handling. Quoted apostrophes, \', U+2019 and
numeric non-breaking spaces are accepted. Undeclared entities, malformed XML,
unescaped apostrophes and invalid Unicode escapes fail. External entities are
never fetched. Verification never rewrites XML or enforces typography, brand spelling or CDATA
spelling. Structural equality also preserves custom entity references.
--structural-equality uses Java printf argument compatibility on decoded item
text, checks array lengths and formatting-mode changes, and validates source and
target printf syntax. formatted="false" skips printf checks; item attributes
override their resource. Plurals require distinct supported quantities and
other; target-only quantities compare against the source other item.
Locale-specific category equality is not required. translatable="false"
resources are excluded, and unrelated Android resource types are ignored.
This is a string-resource verifier, not a replacement for AAPT2 resource linking. See Android string resource rules.
Preserve custom entity references#
In Android mode, --structural-equality compares custom XML entity names and
occurrence counts in each corresponding string, array item or plural item:
formatjs verify 'app/src/main/res/**/*.xml' \
--message-syntax android --source-locale en \
--structural-equality --missing-keys
&brand; cannot become literal text or another entity, and repeated references
cannot be dropped or duplicated. Reordering within an item is allowed; moving
references between array/plural items fails. Target-only plural categories use
the source other item. Checks include inline attributes and apply even with
formatted="false", which only skips printf checks. Missing resources still
require --missing-keys.
Predefined XML entities (amp, lt, gt, apos, quot), numeric references,
comments, processing instructions and CDATA contents are excluded. For example,
&brand; and <![CDATA[&brand;]]> are literal text, not references to brand.
Entity definitions remain validated XML, but their replacement values are not
compared. Basic XML verification without --structural-equality still accepts
equivalent expanded text.
Preserve native markup and resource references#
Android --structural-equality also compares inline element names, attributes,
counts and nesting in each corresponding item. Sibling reordering is allowed;
XLIFF wrappers are metadata and do not affect this comparison. XML namespace
prefix spelling and attribute order do not matter. Escaped HTML and CDATA remain
text; their HTML contents are not parsed. Text-to-span positions are not compared.
Whole-value resource references such as @string/name, @android:string/ok and
?attr/name must keep their targets. @null and @empty are also preserved.
Theme shorthand ?name is equivalent to ?attr/name; package prefixes resolve
through Android resource namespace declarations. Detection uses XML-decoded
text before Android unescaping: \@string/name and "@string/name" are literal
text, so neither can replace an actual reference. Native styled spans also force
text interpretation, as in AAPT2. Resource lookup and linking remain AAPT2's job.
These checks apply to strings, array items and plural items, including
formatted="false". Target-only plural quantities compare against source other.