Localizing a Metric View
Este conteúdo não está disponível em sua língua ainda.
The same metric view can be called “Typing Patterns” in an English Playground and “Gestes de frappe” in a French one. Its labels change, but the calculation and displayed percentage stay the same.
Add Translations
Section titled “Add Translations”Open the view for editing and add a top-level [localization.fr-FR] table for French. Use the original display text as the key, with the same capitalization and punctuation. Switch the Playground interface to French and preview the view to check the result.
The example uses the standard document structure. hide_header hides the column heading without removing its accessible label. The cell query computes the percentage, and format displays it.
schema_version = 1name = "Typing Patterns"
[[sections]]label = "Movement"columns = [{ label = "Bigram", hide_header = true }]
[[sections.rows]]label = "Same finger"cells = [{ query = "bi.sf.freq * 100", format = "%.2f%%", label = "Share of bigrams" }]
[localization.fr-FR]"Typing Patterns" = "Gestes de frappe""Movement" = "Mouvement""Bigram" = "Bigrammes""Same finger" = "Même doigt""Share of bigrams" = "Part des bigrammes"Labels the View Uses
Section titled “Labels the View Uses”| Text to translate | Where it comes from |
|---|---|
| View title | name at the top of the file |
| Section heading | label in a section |
| Column heading | The text in columns, or the column object’s label |
| Row heading | label in a row |
| Cell label | An explicit label on a query or saved-metric cell. Without an explicit label, a saved-metric cell can inherit the saved metric’s binding label. Use the effective label as the translation key. |
The table applies to every matching label in the view. If two occurrences need different translations, give them different original labels. Omitted translations fall back to the authored text. This is an exact lookup against the resolved interface locale: for example, a browser preference of fr-CA resolves to the supported Playground locale fr-FR, so use [localization.fr-FR].
Names in the Picker
Section titled “Names in the Picker”In the Metrics pane, each view in a stack is translated separately. Built-in picker entries use the translated view title; saved views and working copies still appear under their document names in the picker. Localization does not rename those documents. Metric IDs, query expressions, numeric format strings, result values, and the saved TOML do not change when the interface language changes.