You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The document describes the proper way to introduce new text to dashboard.
4
+
5
+
## Overview
6
+
7
+
Dashboard is currently localized through the Google Closure Compiler's `goog.getMsg()` primitive. It allows the developer to define text that needs to be localized as simple variables anywhere in the code.
8
+
9
+
The localization process itself is integrated into the build pipeline and back-end component of Dashboard and happens automatically. Apart from placing new text into `MSG_` variables and using those in the angular templates, the developer is not required to do anything else.
10
+
11
+
## The MSG variables
12
+
13
+
Here is an example of a single `MSG_` variable definition:
14
+
15
+
```{js}
16
+
/** @export {string} @desc The text appears when the image pull secret name exceeds the maximal length. */
17
+
let MSG_IMAGE_PULL_SECRET_NAME_LENGTH_WARNING =
18
+
goog.getMsg('Name must be up to {$maxLength} characters long.', {maxLength: '253'});
19
+
```
20
+
21
+
Guidelines:
22
+
* All variable names *must* start with `MSG_`.
23
+
* Placeholders (`maxLength` above) are parts of the text that should remain the same in all translations.
24
+
* The description of each variable (`@desc` above) should describe the context of its usage. It is supposed to help the translator.
25
+
* The JavaDoc, containing all the annotations, should be kept at 1 line to reduce scrolling time.
26
+
27
+
For a quick reference please see [this cheat sheet](http://www.closurecheatsheet.com/i18n).
28
+
29
+
## Organizing the text variables
30
+
31
+
Currently, the `MSG` variables are stored in a constant dictionary at the bottom of the controller, which scopes the place (template) where they are used. The variables can then be referenced directly in the respective template's HTML code.
32
+
33
+
Here is an example of how to organize and use such variables:
34
+
35
+
```{js}
36
+
class exampleController {
37
+
constructor() {
38
+
...
39
+
40
+
/**
41
+
* @export
42
+
*/
43
+
this.i18n = i18n;
44
+
45
+
...
46
+
}
47
+
}
48
+
49
+
const i18n = {
50
+
/** @export {string} @desc a simple example */
51
+
MSG_EXAMPLE_TEXT: goog.getMsg('This is an example'),
52
+
... // other variables
53
+
}
54
+
```
55
+
56
+
```{html}
57
+
<html-block>
58
+
{::ctrl.i18n.MSG_EXAMPLE_TEXT}}
59
+
</html-block>
60
+
```
61
+
62
+
In the HTML code, use one-time bindings like `{{::ctrl.i18n.MSG_EXAMPLE_TEXT}}` for efficiency.
63
+
64
+
## Naming conventions and guidelines
65
+
* Consistently name the object containing the variables for a given controller `i18n`.
66
+
* In the variable's name, after `MSG_`, try to write down the name of the controller (or part of Dashboard) to indicate where the variable is being used.
67
+
* The suffix of the name should indicate the type (or role) of the text-resource in dashboard.
<translationid="8895655645940102616"key="MSG_DEPLOY_APP_NAME_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the "App name" on the deploy page.">An 'app' label with this value will be added to the Replication Controller and Service that get deployed.</translation>
5
+
<translationid="1629323405372811987"key="MSG_NAMESPACE_CREATE_DIALOG_TITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create namespace dialog title. The message appears at the top of the dialog box.">Create a new namespace</translation>
6
+
<translationid="7894572953642738628"key="MSG_NAMESPACE_CREATE_DIALOG_SUBTITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create namespace dialog subtitle. Appears right below the title.">The new namespace will be added to the cluster</translation>
7
+
<translationid="2275990529199837995"key="MSG_NAMESPACE_NAME_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Namespace name', which appears as a placeholder in an empty input field in the create namespace dialog.">Namespace name</translation>
8
+
<translationid="6583711267159567196"key="MSG_NAMESPACE_NAME_PATTERN_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the namespace name does not match the expected pattern.">Name must be alphanumeric and may contain dashes</translation>
9
+
<translationid="3466771004397854426"key="MSG_NAMESPACE_NAME_LENGTH_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the namespace name exceeds the maximal length.">Name must be up to <phname="MAX_LENGTH" /> characters long</translation>
10
+
<translationid="4267128307522257099"key="MSG_NAMESPACE_NAME_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the namespace name is required.">Name is required</translation>
11
+
<translationid="3530355110223734851"key="MSG_NAMESPACE_CREATE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Create' button in the namespace creation dialog.">Create</translation>
12
+
<translationid="4850098313852875572"key="MSG_NAMESPACE_CANCEL_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Cancel' button in the namespace creation dialog.">Cancel</translation>
13
+
<translationid="6489624424433759035"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_TITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create image pull secret dialog title. The message appears at the top of the dialog box.">Create a new image pull secret</translation>
14
+
<translationid="3382981767955244666"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_SUBTITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create image pull secret dialog subtitle. Appears right below the title.">The new secret will be added to the cluster</translation>
15
+
<translationid="696865387402025901"key="MSG_IMAGE_PULL_SECRET_NAME_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Secret name', which appears as a placeholder in an empty input field in the image pull secret creation dialog.">Secret name</translation>
16
+
<translationid="7256994603560688149"key="MSG_IMAGE_PULL_SECRET_NAME_PATTERN_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret name does not match the expected pattern.">Name must follow the DNS domain name syntax (e.g. new.image-pull.secret)</translation>
17
+
<translationid="4127420758208322272"key="MSG_IMAGE_PULL_SECRET_NAME_LENGTH_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret name exceeds the maximal length.">Name must be up to <phname="MAX_LENGTH" /> characters long.</translation>
18
+
<translationid="7263428501718162087"key="MSG_IMAGE_PULL_SECRET_NAME_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the image pull secret name is required.">Name is required.</translation>
19
+
<translationid="8342519402917559446"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the create image pull secret dialog. Directly after this text a specific namespace is specified.">A secret with the specified name will be added to the cluster in the namespace</translation>
20
+
<translationid="2983148182170296230"key="MSG_IMAGE_PULL_SECRET_DATA_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Image pull secret data', which appears as a placeholder in an empty input field in the image pull secret creation dialog.">Image pull secret data</translation>
21
+
<translationid="3432622161353334586"key="MSG_IMAGE_PULL_SECRET_DATA_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the image pull secret data is required.">Data is required</translation>
22
+
<translationid="6217421730854783216"key="MSG_IMAGE_PULL_SECRET_DATA_BASE64_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret data is not Base64 encoded.">Data must be Base64 encoded</translation>
23
+
<translationid="7793557773608682327"key="MSG_IMAGE_PULL_SECRET_DATA_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the input of the "Image Pull Secret" data.">Specify the data for your secret to hold. The value is the Base64 encoded content of a .dockercfg file.</translation>
24
+
<translationid="413516354763358070"key="MSG_IMAGE_PULL_SECRET_CREATE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Create' button in the image pull secret creation dialog.">Create</translation>
25
+
<translationid="919509716730095946"key="MSG_IMAGE_PULL_SECRET_CANCEL_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Cancel' button in the image pull secret creation dialog.">Cancel</translation>
26
+
<translationid="7394607899033025775"key="MSG_IMAGE_PULL_SECRET_LEARN_MORE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is used as a 'Learn more' link text in the image pull secret creation dialog">Learn more</translation>
<translationid="8895655645940102616"key="MSG_DEPLOY_APP_NAME_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the "App name" on the deploy page.">An 'app' label with this value will be added to the Replication Controller and Service that get deployed.</translation>
5
+
<translationid="1629323405372811987"key="MSG_NAMESPACE_CREATE_DIALOG_TITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create namespace dialog title. The message appears at the top of the dialog box.">Create a new namespace</translation>
6
+
<translationid="7894572953642738628"key="MSG_NAMESPACE_CREATE_DIALOG_SUBTITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create namespace dialog subtitle. Appears right below the title.">The new namespace will be added to the cluster</translation>
7
+
<translationid="2275990529199837995"key="MSG_NAMESPACE_NAME_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Namespace name', which appears as a placeholder in an empty input field in the create namespace dialog.">Namespace name</translation>
8
+
<translationid="6583711267159567196"key="MSG_NAMESPACE_NAME_PATTERN_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the namespace name does not match the expected pattern.">Name must be alphanumeric and may contain dashes</translation>
9
+
<translationid="3466771004397854426"key="MSG_NAMESPACE_NAME_LENGTH_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the namespace name exceeds the maximal length.">Name must be up to <phname="MAX_LENGTH" /> characters long</translation>
10
+
<translationid="4267128307522257099"key="MSG_NAMESPACE_NAME_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the namespace name is required.">Name is required</translation>
11
+
<translationid="3530355110223734851"key="MSG_NAMESPACE_CREATE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Create' button in the namespace creation dialog.">Create</translation>
12
+
<translationid="4850098313852875572"key="MSG_NAMESPACE_CANCEL_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Cancel' button in the namespace creation dialog.">Cancel</translation>
13
+
<translationid="6489624424433759035"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_TITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create image pull secret dialog title. The message appears at the top of the dialog box.">Create a new image pull secret</translation>
14
+
<translationid="3382981767955244666"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_SUBTITLE"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Create image pull secret dialog subtitle. Appears right below the title.">The new secret will be added to the cluster</translation>
15
+
<translationid="696865387402025901"key="MSG_IMAGE_PULL_SECRET_NAME_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Secret name', which appears as a placeholder in an empty input field in the image pull secret creation dialog.">Secret name</translation>
16
+
<translationid="7256994603560688149"key="MSG_IMAGE_PULL_SECRET_NAME_PATTERN_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret name does not match the expected pattern.">Name must follow the DNS domain name syntax (e.g. new.image-pull.secret)</translation>
17
+
<translationid="4127420758208322272"key="MSG_IMAGE_PULL_SECRET_NAME_LENGTH_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret name exceeds the maximal length.">Name must be up to <phname="MAX_LENGTH" /> characters long.</translation>
18
+
<translationid="7263428501718162087"key="MSG_IMAGE_PULL_SECRET_NAME_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the image pull secret name is required.">Name is required.</translation>
19
+
<translationid="8342519402917559446"key="MSG_IMAGE_PULL_SECRET_CREATE_DIALOG_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the create image pull secret dialog. Directly after this text a specific namespace is specified.">A secret with the specified name will be added to the cluster in the namespace</translation>
20
+
<translationid="2983148182170296230"key="MSG_IMAGE_PULL_SECRET_DATA_LABEL"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Label 'Image pull secret data', which appears as a placeholder in an empty input field in the image pull secret creation dialog.">Image pull secret data</translation>
21
+
<translationid="3432622161353334586"key="MSG_IMAGE_PULL_SECRET_DATA_REQUIRED_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="Warning which tells the user that the image pull secret data is required.">Data is required</translation>
22
+
<translationid="6217421730854783216"key="MSG_IMAGE_PULL_SECRET_DATA_BASE64_WARNING"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text appears when the image pull secret data is not Base64 encoded.">Data must be Base64 encoded</translation>
23
+
<translationid="7793557773608682327"key="MSG_IMAGE_PULL_SECRET_DATA_USER_HELP"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="User help text for the input of the "Image Pull Secret" data.">Specify the data for your secret to hold. The value is the Base64 encoded content of a .dockercfg file.</translation>
24
+
<translationid="413516354763358070"key="MSG_IMAGE_PULL_SECRET_CREATE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Create' button in the image pull secret creation dialog.">Create</translation>
25
+
<translationid="919509716730095946"key="MSG_IMAGE_PULL_SECRET_CANCEL_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is put on the 'Cancel' button in the image pull secret creation dialog.">Cancel</translation>
26
+
<translationid="7394607899033025775"key="MSG_IMAGE_PULL_SECRET_LEARN_MORE_ACTION"source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js"desc="The text is used as a 'Learn more' link text in the image pull secret creation dialog">Learn more</translation>
0 commit comments