String resources for internationalization (i18n)
See original GitHub issueI’d like to see an example of how to do internationalization for Compose Desktop.
I looked at the Code Viewer example, as it’s written to run under both Android and desktop. It doesn’t yet address that feature; its Text widgets and contentDescription values are hard-coded, e.g. https://github.com/JetBrains/compose-jb/blob/4de10a649910053ed634429b88c82541989bf332/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/editor/EditorEmptyView.kt#L28-L29
Can we use stringResource
(from androidx.compose.ui.res
) on desktop? How do we get the resource ID if we’re developing for desktop and not using Android Studio?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:19
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Resource Files Best Practices for i18n & Localization - Lingoport
User-facing strings are typically found in user interfaces: menu items, labels, descriptions, and text elements that are rendered in the application.
Read more >A Step-by-Step Guide to Go Internationalization (i18n)
A Step-by-Step Guide to Go Internationalization (i18n) ... A Catalog defines collections of translated format strings.
Read more >Internationalizing UI Strings | Adobe Experience Manager
The I18n class provides the get method that retrieves localized strings from the AEM dictionary. The only required parameter of the get method ......
Read more >Chapter 16. Internationalization, localization and themes
You'll also need localized strings for all the messages in your application (for example field labels on your views). First you need to...
Read more >Internationalization Guide - Java - Oracle Help Center
All locale-sensitive classes must be able to access resources customized for the locales they support. To aid in the process of localization, it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@igordmn, @keturn just migrated Moko-Resources from
ChoiceFormat
toPluralRules
-> https://github.com/icerockdev/moko-resources/commit/97489b6e92bc57ae99770fcb2cf0a39033b195b9One of the complex things is pluraziation support.
Java only provides ChoiceFormat, which properly works only with some languages.
Proper pluraziation support implemented in ICU.
We can provide a function for pluralization in skiko (because skia already uses icu library).
Or write a pluralization function in pure Kotlin/Java using patterns (example)
Another thing we need to think about - how string resources should be defined:
Don’t know if it is a good idea. It maybe convinient for string formatting, but not convinient for translators.