Localization
If you want to localize your Toolkit, it becomes important to consolidate "localizable" content in a central place so localization teams (e.g. L18N team in Galvanize) can easily and quickly translate these for you.
The easiest pattern is to consolidate these inside YAML files per locale. Below is an example of creating a Collection in two potential locales.
Assuming a folder structure of:
locales
|- de.yml
|- en.yml
main.tf
You'd want you de.yml
like so:
collection:
name: Deutcher Name
description: Deutsche Bechreibung
And your en.yml
like so:
collection:
name: English name
description: English description
With those locale files setup, you can now write the following Terraform:
variable org_locale {
default = "en"
description = "Locale to install Toolkits in"
}
locals {
# Dynamically load the desired locale
# For ease (and by convention), store this in `t` locale
t = yamldecode(file("${path.module}/locales/${var.org_locale}.yml"))
}
resource highbond_collection main {
name = local.t.collection.name
description = local.t.collection.description
}
You can now execute this Terraform script in the desired locale by passing in the appropriate variable:
# English
terraform apply -var="org_locale=en"
# German
terraform apply -var="org_locale=de"
In the Toolkits Service, the org_locale
variable will be passed in by default and is available if you need it.