Skip to content

Fix source matching and locale placeholders in the Crowdin config - #839

Merged
JingMatrix merged 1 commit into
masterfrom
crowdin-sync
Aug 1, 2026
Merged

Fix source matching and locale placeholders in the Crowdin config#839
JingMatrix merged 1 commit into
masterfrom
crowdin-sync

Conversation

@JingMatrix

Copy link
Copy Markdown
Owner

Source patterns: within a path node the CLI compiles * to .+ and matches it anchored, so a * must consume at least one character. strings*.xml can therefore never select strings.xml, and a file that no pattern selects never becomes a candidate — it is neither uploaded nor reported as missing. ** is special only as a whole path node and ? only adds a further required character, so naming each source file is the one formulation without that hole.

Locale placeholders: %android_code% is region-qualified for every language, while a resource folder carries a region only where one disambiguates a variant. Using it requires one mapping entry per language to strip the region back off, in perpetuity, and a language enabled later without such an entry resolves to a folder that does not exist — translation upload derives one expected path per target language and skips what it cannot find. %two_letters_code% already agrees with the unqualified folders, so only the genuinely region-qualified locales and the codes Android kept after the ISO renames need entries, and those now live in the repository instead of in project state no checkout can see.

translation doubles as the file's server-side export pattern and is expanded there, where the local mapping has no say, so the same overrides must exist in the project's language settings for downloads to resolve. The workflow trigger names the same files rather than globbing them: its matching rules and the CLI's are defined independently, and a trigger that quietly never fires is the worse failure.

Two independent defects, both of which the tooling reports as success.

Source patterns. Within a path node the CLI compiles `*` to `.+` and applies the
result as an anchored match, so a `*` must consume at least one character. A
pattern of the form `strings*.xml` therefore selects only names that carry
something between the stem and the extension, never the bare `strings.xml`. A
file that no pattern selects never enters the candidate set, so the upload
neither includes it nor reports it as missing: the failure is silent by
construction. Neither `**` nor `?` closes the gap — `**` is special only as a
whole path node, and `?` adds a further required character. Naming each source
file is the only formulation without such a hole.

Locale placeholders. %android_code% is region-qualified for every language,
whereas an Android resource folder carries a region only where one is needed to
disambiguate a variant. Aligning folders with it would require one mapping entry
per language to strip the region back off — an obligation that grows with every
language added and degrades silently when forgotten, since translation upload
derives one expected path per target language and skips the ones it cannot find.
%two_letters_code% inverts the default: it already agrees with the unqualified
folders, so only the genuinely region-qualified locales, plus the codes Android
retained after the ISO renames, need an entry. Those are now written down in the
repository rather than left implicit in project state that no checkout can see.

The mapping is repeated per file because it is a file-level key; a YAML anchor
keeps the four entries identical by construction.

The `translation` value doubles as the file's server-side export pattern and is
expanded there, where the local mapping does not apply, so the same overrides
must exist in the project's language settings for downloads to resolve. Nothing
in CI observes this, as it does not download translations.

The workflow trigger now names the same files instead of globbing them. Its
matching rules and the CLI's are defined independently, and a trigger that
quietly never fires is the worse failure of the two.

Before this reaches master: hosted word count scales with the number of target
languages, so the newly matched source file has to wait until the files orphaned
by the previous layout are removed from the project.
@JingMatrix
JingMatrix merged commit 541a3aa into master Aug 1, 2026
1 check failed
@JingMatrix
JingMatrix deleted the crowdin-sync branch August 1, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant