Ir al contenido

Localizing a Metric View

Esta página aún no está disponible en tu idioma.

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.

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 = 1
name = "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"
Text to translateWhere it comes from
View titlename at the top of the file
Section headinglabel in a section
Column headingThe text in columns, or the column object’s label
Row headinglabel in a row
Cell labelAn 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].

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.