Skip to content

Allow strings.xml to contain plurals - #884

Open
dewantawsif wants to merge 1 commit into
icerockdev:developfrom
dewantawsif:plural
Open

Allow strings.xml to contain plurals#884
dewantawsif wants to merge 1 commit into
icerockdev:developfrom
dewantawsif:plural

Conversation

@dewantawsif

Copy link
Copy Markdown
Contributor

Closes #875

@ExNDY

ExNDY commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

How it work on others targets? You doesnt add test cases for check your changes. Now it's cant be approved

@dewantawsif

Copy link
Copy Markdown
Contributor Author

As explained in the linked issue the change only allows the generator to find plurals from strings.xml. The process is no different to extracting plurals from plurals.xml. The PR doesn't touch anything else to create a boarder effect.

@ExNDY

ExNDY commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The fact that mixed value resources are conventional in Android does not make that convention appropriate for the platform-neutral moko-resources input format. commonMain/moko-resources is not Android’s res/values.
findPluralNodes() is a node selector, not a guardrail. Expanding the filter makes the same physical file an implicit input to multiple independent generators, without duplicate detection, precedence rules, or validation when the same plural is declared in both plurals*.xml and strings*.xml. Adding strings*.xml to one factory is an Android-specific special case that weakens the existing resource-type separation.

@dewantawsif

Copy link
Copy Markdown
Contributor Author

The fact that mixed value resources are conventional in Android does not make that convention appropriate for the platform-neutral moko-resources input format. commonMain/moko-resources is not Android’s res/values.

I'm not aware of any standard for i18n in JS or Wasm so can't comment on that but both Apple Platform and JVM has the same convention.

Apple Platforms: https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog#Add-variants-for-strings-that-contain-plurals
JVM: https://docs.oracle.com/javase/8/docs/api/java/text/ChoiceFormat.html with https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html

findPluralNodes() is a node selector, not a guardrail. Expanding the filter makes the same physical file an implicit input to multiple independent generators, without duplicate detection, precedence rules, or validation when the same plural is declared in both plurals*.xml and strings*.xml.

The same is true when a single plurals*.xml file has duplicates.

Adding strings*.xml to one factory is an Android-specific special case that weakens the existing resource-type separation.

Would having it be a opt-in option suffice?

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.

2 participants