Internationalization
Homey Apps support internationalization so that users can use your app in their native language.
Homey Apps can store translated strings as JSON files in the /locales/
folder with the language code as filename. See these two example translation files for English and Dutch:
These files define translations with the ID's: title
, greeting
, settings.title
, settings.intro
, and pair.press_button
. If a translated string with a certain ID is not present in the locale file for the users locale Homey will fall-back to English.
The translation object
You can also input a single string, when translation isn't necessary:
Temperature conversion
Your Homey app should always use Celsius internally, Homey will automatically converts capability values from Celsius to Fahrenheit. For custom capabilities make sure the "unit"
is set to "°C"
to let Homey know that this value should be converted.
Supported Languages
The following languages are currently supported for any Homey app.
en
: Englishnl
: Dutchde
: Germanfr
: Frenchit
: Italiansv
: Swedishno
: Norwegianes
: Spanishda
: Danishru
: Russianpl
: Polishko
: South Korean
Translating a string from your app
In your App, Drivers or Devices you can call this.homey.__()
with the identifier of the translated string to get the translation. In the following example we define a translation with the ID title
and use the translation in app.js
.
You can also use variables in your translations. In the translated string variables are surrounded by two underscores (__
). To get the translated string with variables you should pass an object to this.homey.__()
as the second argument with the values that you want to use for those variables.
Translating a string in Custom views
Within your custom views, you can also use translations. For example:
It is also possible to get translated strings with JavaScript:
Translating with OpenAI
Then, execute in a command line:
Last updated
Was this helpful?