One Off the Slack: Where Do the Strings Go?

mibrahim asked:

in a full complete compose app, where strings will be saved, in Strings.kt as const or what, if this is the case what about the Localization part, pardon my ignorance if it was a basic question but I just got started

mibrahim later clarified that Android was the target, not some other platform.

Google’s Adam Powell replied:

compose doesn’t add any new facilities for string localization, at least not yet. Look to the usual strings.xml and such on android or other platform-specific equivalents

mibrahim continued:

If may I ask is there any plans to deprecate other res[xm] files .. I mean isn’t that the whole point to go all kotlin with its full power to arrange code

Adam then explained more in depth:

not currently but we’ve got some ongoing discussions with the android resources/aapt teams around what static resources consumed from kotlin (with or without compose) should look like in the future

many workflows for app development involve ingesting translations from other, sometimes external toolchains and vendors

using kotlin code for translated string constants comes with a lot of associated downsides

once apps start getting large, translations can account for megabytes of data in an app. Many times they’re downloaded on the fly by one means or another, whether that’s explicit server communication or apk resource splits

tossing all of that into the app’s static string tables and letting the classloader sort it out is a recipe for a lot of, “this was never meant to do this” stress testing

André Kindwall then asked:

Will there be some equivalent to RRO for vendors to use? (If/when SystemUI uses compose)

Adam responded:

yes, that would also be a requirement for anything that would intend to replace rather than augment the existing resource system


Read the original thread in the kotlinlang Slack workspace. Not a member? Join that Slack workspace here!