Sign in Go Pro

Building a plugin for Android Studio

Localization and Strings

11/09/2020

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

In this lesson, you will learn how to localize your plugin to make it available in different languages and how to correctly use strings.

Instructor

Links

Comments

Hello! is it possible to localize strings in the plugin.xml file? For example, when supporting spanish, you want the text shown at the menu to be spanish too, so that instead of something like text="_Trello Action" in the action declaration, it will be text="@localizedTrelloAction" or something. This means that the text in the menu will change depending on the language settings. Is this possible? and how do I achieve this?

Thanks for your comment. The trick is to do that in the action itself. The same way you can override the update method to enable or disable an action you can also set the text there.

override fun update(e: AnActionEvent) {
e.presentation.text = StringsBundle.string("action.title")
}

>

Lessons in Building a plugin for Android Studio