File: translate.html

package info (click to toggle)
cockpit 239-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 67,268 kB
  • sloc: javascript: 245,474; ansic: 72,273; python: 23,634; xml: 6,155; sh: 2,919; makefile: 923; sed: 5
file content (179 lines) | stat: -rw-r--r-- 6,860 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html ng-csp>
<head>
    <meta charset="utf-8">
    <title>Cockpit playground</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../base1/cockpit.js"></script>
</head>
<body class="pf-m-redhat-font" hidden>
   <div class="pf-c-page">
        <main class="pf-c-page__main" tabindex="-1">
            <section id="internal" class="pf-c-page__main-section pf-m-light">
                <h2>HTML translations</h2>

                <p>For translating HTML use these forms:<p>

                <p>
                    <code>&lt;span translate&gt;Ready&lt;/span&gt;</code>
                    = <span translate id="translate-html">Ready</span>
                </p>

                <p>
                    <code>&lt;span translate translate-context="verb"&gt;Ready&lt;/span&gt;</code>
                    = <span translate translate-context="verb" id="translate-html-context">Ready</span>
                </p>

                <p>
                    <code>&lt;span translate="yes"&gt;Not ready&lt;/span&gt;</code>
                    = <span translate="yes" id="translate-html-yes">Not ready</span>
                </p>

                <p>
                    <code>&lt;span translate="title" title="Unavailable"&gt;Cancel&lt;/span&gt;</code>
                    = <span translate="title" title="Unavailable" id="translate-html-title">Cancel</span>
                </p>

                <p>
                    <code>&lt;span translate="yes title" title="Unavailable"&gt;Cancel&lt;/span&gt;</code>
                    = <span translate="yes title" title="Unavailable" id="translate-html-yes-title">Cancel</span>
                </p>

                <p>Note that we do <b>not support</b>:<p>
                <ul>
                    <li>Interpolation of variables.</li>
                    <li>Pluralization</li>
                    <li>The <code>&lt;translate&gt;</code> element</li>
                </ul>

                <hr>

                <h2>Old Glade style</h2>

                <p>The old Glade style is not recommended:<p>

                <p>
                    <code>&lt;span translate="yes"&gt;Empty&lt;/span&gt;</code>
                    = <span translate="yes" id="translatable-glade">Empty</span>
                </p>

                <p>
                    <code>&lt;span translate="yes" context="verb"&gt;Empty&lt;/span&gt;</code>
                    = <span translate="yes" context="verb" id="translatable-glade-context">Empty</span>
                </p>

                <p>Note that we do <b>not support</b>:<p>
                <ul>
                    <li>Interpolation of variables.</li>
                    <li>Translatable attributes.</li>
                    <li>Pluralization</li>
                    <li>The <code>&lt;translate&gt;</code> element</li>
                </ul>

                <hr>

                <h2>Mustache translations</h2>

                <p>For translating Mustache use these forms:<p>

                <div id="mustache-output">
                </div>

                <script id="mustache-input" type="x-template/mustache">
                    <p>
                        <code>&lt;span translate="yes"&gt;User&lt;/span&gt;</code>
                        = <span translate="yes" id="translatable-mustache">User</span>
                    </p>

                    <p>
                        <code>&lt;span translate&gt;Memory&lt;/span&gt;</code>
                        = <span translate id="translate-mustache">Memory</span>
                    </p>

                    <p>
                        <code>&lt;span translate="yes"&gt;Accounts&lt;/span&gt;</code>
                        = <span translate="yes" id="translate-mustache-yes">Accounts</span>
                    </p>

                    <p>
                        <code>&lt;span translate="title" title="Error"&gt;User&lt;/span&gt;</code>
                        = <span translate="title" title="Error" id="translate-mustache-title">User</span>
                    </p>

                    <p>
                        <code>&lt;span translate="yes title" title="Error"&gt;User&lt;/span&gt;</code>
                        = <span translate="yes title" title="Error" id="translate-mustache-yes-title">User</span>
                    </p>
                </script>

                <p>Note that we do <b>not support</b>:<p>
                <ul>
                    <li>Interpolation of variables.</li>
                    <li>Pluralization</li>
                    <li>The <code>&lt;translate&gt;</code> element</li>
                </ul>
                <hr>

                <h2>Code Translations</h2>

                <p>For translating in javascript code, use these forms:</p>

                <p>
                    <code>_("Empty")</code>
                    = <span id="underscore-empty"></span>
                </p>

                <p>
                    <code>_("verb", "Empty")</code>
                    = <span id="underscore-context-empty"></span>
                </p>

                <p>
                    <code>C_("verb", "Empty")</code>
                    = <span id="cunderscore-context-empty"></span>
                </p>

                <p>
                    <code>cockpit.gettext("Control")</code>
                    = <span id="gettext-control"></span>
                </p>

                <p>
                    <code>cockpit.gettext("key", "Control")</code>
                    = <span id="gettext-context-control"></span>
                </p>

                <p>
                    <code>cockpit.ngettext("$0 disk is missing", "$0 disks are missing", 1)</code>
                    = <span id="ngettext-disks-1"></span>
                </p>

                <p>
                    <code>cockpit.ngettext("$0 disk is missing", "$0 disks are missing", 2)</code>
                    = <span id="ngettext-disks-2"></span>
                </p>

                <p>
                    <code>cockpit.ngettext("disk-non-rotational", "$0 disk is missing", "$0 disks are missing", 1)</code>
                    = <span id="ngettext-context-disks-1"></span>
                </p>

                <p>
                    <code>cockpit.ngettext("disk-non-rotational", "$0 disk is missing", "$0 disks are missing", 2)</code>
                    = <span id="ngettext-context-disks-2"></span>
                </p>

                <p>Note that we do <b>not support</b>:<p>
                <ul>
                    <li>Extraction of single quoted strings.</li>
                </ul>
            </section>
        </main>
    </div>
    <script src="translate.js"></script>
    <!-- Bring in initial translations -->
    <script src="../*/po.js"></script>
    <!-- Override translations from here -->
    <script src="po.extra.js"></script>
</body>
</html>