I am really missing i18n support for “normal” Kotlin projects in Intellij IDEA.
Android development has a very comfortable support for localizing all kinds of resources.
Intellij IDEA has some basic support for String localization but apparently this only works for Java code.
Is there really no solution for Kotlin?
@tango24 can you provide which part is doesn’t works?
I couldn’t make any of it work:
- No inspection for Hard coded string literals
- No quick fix for I18nize hard coded string literal
- No Find usage in properties file
- No navigation between properties and code
All - I believe - provided by I18N plugin, which only works for Java code
Is there anything I missed to get this working?
Furthermore I really appreciate how Android integration shows actual text instead of resource key.
This works for Kotlin, but only in Android projects.
Good catch. Probably make sense to create a feature request for that in kotl.in/issue
Any news on this feature? An year has passed but still no internationalization support yet.
Ah, well aktually theres an update.
Kotlin IDE does understand org.jetbrains.annotations.PropertyKey, but it does not always work.
I have had problems if the bundle contains more than one language.
Example:
fun message(@PropertyKey(resourceBundle = "Messages") id: String) =
ResourceBundle.getBundle("Messages").getString(sid) ?: "###$id###"
I18n general integration with support for Kotlin was done in IntelliJ IDEA 2018.2 (see https://youtrack.jetbrains.com/issue/KT-24487). The problem you’re describing looks like https://youtrack.jetbrains.com/issue/KT-30053. If it’s not, please file a separate issue at http://kotl.in/issue. Thanks.