Migrating to CMP resources, I have one use case wh...
# compose
s
Migrating to CMP resources, I have one use case which I am not sure is supported by this compared to the normal Android resources. I had a file under the
values
directory, next to the
strings.xml
file, which was named
static_strings.xml
. This had this sort of content in there:
Copy code
<resources>
    <string name="foo" translatable="false">Foo</string>
    ...
</resources>
Which were strings that did not require translation. When moving this to commonMain these strings are simply not picked up. This may be because CMP expects just a file named specifically
strings.xml
or it doesn't like the
translatable="false"
part
What I will do for now is just take these strings and copy-paste them in all the individual strings.xml files for each language, which will work just fine. But I am curious if this is supported in some way.
c
AFAIK the
translatable="false"
should work.
v
Another solution may be to place them in code. For example, I have measurement unit symbols and file extensions defined as enums with overwritten
toString
methods. Non-localized strings do not belong in resources in my opinion.
s
AFAIK the
translatable="false"
should work.
Yeah my guess is mostly that it doesn't like the odd name of the file itself tbh.
Non-localized strings do not belong in resources in my opinion.
In this case, these strings are specifically used in the language picker of the app So we want the string to be the language name exactly as it is in that same language. So to me, this particular use case really still feels like it should be in
strings.xml
instead of somewhere in code.
k
file can be named as you want. it doesn't matter. but there is no
translatable="false"
feature for CMP resources
c
Okay so I was wrong. BRB searching for
translatable="false"
in my project ...
🦜 1