/** * Copyright (c) 2014 Vincent Petry * * This file is licensed under the Affero General Public License version 3 * or later. * * See the COPYING-README file. * */ /** * L10N namespace with localization functions. * * @namespace */ OC.L10N = { /** * String bundles with app name as key. * @type {Object.} */ _bundles: {}, /** * Plural functions, key is app name and value is function. * @type {Object.} */ _pluralFunctions: {}, /** * Load an app's translation bundle if not loaded already. * * @param {String} appName name of the app * @param {Function} callback callback to be called when * the translations are loaded * @return {Promise} promise */ load: function(appName, callback) { // already available ? if (this._bundles[appName] || OC.getLocale() === 'en') { var deferred = $.Deferred(); var promise = deferred.promise(); promise.then(callback); deferred.resolve(); return promise; } var self = this; var url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json'); // load JSON translation bundle per AJAX return $.get(url) .then( function(result) { if (result.translations) { self.register(appName, result.translations, result.pluralForm); } }) .then(callback); }, /** * Register an app's translation bundle. * * @param {String} appName name of the app * @param {Object} bundle * @param {Function|String} [pluralForm] optional plural function or plural string */ register: function(appName, bundle, pluralForm) { this._bundles[appName] = bundle || {}; if (_.isFunction(pluralForm)) { this._pluralFunctions[appName] = pluralForm; } else { // generate plural function based on form this._pluralFunctions[appName] = this._generatePluralFunction(pluralForm); } }, /** * Generates a plural function based on the given plural form. * If an invalid form has been given, returns a default function. * * @param {String} pluralForm plural form */ _generatePluralFunction: function(pluralForm) { // default func var func = function (n) { var p = (n !== 1) ? 1 : 0; return { 'nplural' : 2, 'plural' : p }; }; if (!pluralForm) { console.warn('Missing plural form in language file'); return func; } /** * code below has been taken from jsgettext - which is LGPL licensed * https://developer.berlios.de/projects/jsgettext/ * http://cvs.berlios.de/cgi-bin/viewcvs.cgi/jsgettext/jsgettext/lib/Gettext.js */ var pf_re = new RegExp('^(\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;a-zA-Z0-9_\\(\\)])+)', 'm'); if (pf_re.test(pluralForm)) { //ex english: "Plural-Forms: nplurals=2; plural=(n != 1);\n" //pf = "nplurals=2; plural=(n != 1);"; //ex russian: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10< =4 && (n%100<10 or n%100>=20) ? 1 : 2) //pf = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)"; var pf = pluralForm; if (! /;\s*$/.test(pf)) { pf = pf.concat(';'); } /* We used to use eval, but it seems IE has issues with it. * We now use "new Function", though it carries a slightly * bigger performance hit. var code = 'function (n) { var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) }; };'; Gettext._locale_data[domain].head.plural_func = eval("("+code+")"); */ var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };'; func = new Function("n", code); } else { console.warn('Invalid plural form in language file: "' + pluralForm + '"'); } return func; }, /** * Translate a string * @param {string} app the id of the app for which to translate the string * @param {string} text the string to translate * @param [vars] map of placeholder key to value * @param {number} [count] number to replace %n with * @param {array} [options] options array * @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) * @return {string} */ translate: function(app, text, vars, count, options) { var defaultOptions = { escape: true }, allOptions = options || {}; _.defaults(allOptions, defaultOptions); // TODO: cache this function to avoid inline recreation // of the same function over and over again in case // translate() is used in a loop var _build = function (text, vars, count) { return text.replace(/%n/g, count).replace(/{([^{}]*)}/g, function (a, b) { var r = vars[b]; if(typeof r === 'string' || typeof r === 'number') { if(allOptions.escape) { return escapeHTML(r); } else { return r; } } else { return a; } } ); }; var translation = text; var bundle = this._bundles[app] || {}; var value = bundle[text]; if( typeof(value) !== 'undefined' ){ translation = value; } if(typeof vars === 'object' || count !== undefined ) { return _build(translation, vars, count); } else { return translation; } }, /** * Translate a plural string * @param {string} app the id of the app for which to translate the string * @param {string} textSingular the string to translate for exactly one object * @param {string} textPlural the string to translate for n objects * @param {number} count number to determine whether to use singular or plural * @param [vars] map of placeholder key to value * @param {array} [options] options array * @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) * @return {string} Translated string */ translatePlural: function(app, textSingular, textPlural, count, vars, options) { var identifier = '_' + textSingular + '_::_' + textPlural + '_'; var bundle = this._bundles[app] || {}; var value = bundle[identifier]; if( typeof(value) !== 'undefined' ){ var translation = value; if ($.isArray(translation)) { var plural = this._pluralFunctions[app](count); return this.translate(app, translation[plural.plural], vars, count, options); } } if(count === 1) { return this.translate(app, textSingular, vars, count, options); } else{ return this.translate(app, textPlural, vars, count, options); } } }; /** * translate a string * @param {string} app the id of the app for which to translate the string * @param {string} text the string to translate * @param [vars] map of placeholder key to value * @param {number} [count] number to replace %n with * @return {string} */ window.t = _.bind(OC.L10N.translate, OC.L10N); /** * translate a string * @param {string} app the id of the app for which to translate the string * @param {string} text_singular the string to translate for exactly one object * @param {string} text_plural the string to translate for n objects * @param {number} count number to determine whether to use singular or plural * @param [vars] map of placeholder key to value * @return {string} Translated string */ window.n = _.bind(OC.L10N.translatePlural, OC.L10N); Handlebars.registerHelper('t', function(app, text) { return OC.L10N.translate(app, text); }); ated/noid/master-update-psalm-baseline'>automated/noid/master-update-psalm-baseline Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
blob: e66fabad4ed32e70a27442b258d397c51529cdf2 (plain)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# 
# Translators:
#   <erviker@gmail.com>, 2012.
#   <p.ixiemotion@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-12-20 00:11+0100\n"
"PO-Revision-Date: 2012-12-19 23:11+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n"
"Language-Team: Norwegian Nynorsk (Norway) (http://www.transifex.com/projects/p/owncloud/language/nn_NO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nn_NO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: ajax/apps/ocs.php:20
msgid "Unable to load list from App Store"
msgstr "Klarer ikkje å laste inn liste fra App Store"

#: ajax/creategroup.php:10
msgid "Group already exists"
msgstr ""

#: ajax/creategroup.php:19
msgid "Unable to add group"
msgstr ""

#: ajax/enableapp.php:12
msgid "Could not enable app. "
msgstr ""

#: ajax/lostpassword.php:12
msgid "Email saved"
msgstr "E-postadresse lagra"

#: ajax/lostpassword.php:14
msgid "Invalid email"
msgstr "Ugyldig e-postadresse"

#: ajax/openid.php:13
msgid "OpenID Changed"
msgstr "OpenID endra"

#: ajax/openid.php:15 ajax/setlanguage.php:17 ajax/setlanguage.php:20
msgid "Invalid request"
msgstr "Ugyldig førespurnad"

#: ajax/removegroup.php:13
msgid "Unable to delete group"
msgstr ""

#: ajax/removeuser.php:15 ajax/setquota.php:15 ajax/togglegroups.php:18
msgid "Authentication error"
msgstr "Feil i autentisering"

#: ajax/removeuser.php:24
msgid "Unable to delete user"
msgstr ""

#: ajax/setlanguage.php:15
msgid "Language changed"
msgstr "Språk endra"

#: ajax/togglegroups.php:12
msgid "Admins can't remove themself from the admin group"
msgstr ""

#: ajax/togglegroups.php:28
#, php-format
msgid "Unable to add user to group %s"
msgstr ""

#: ajax/togglegroups.php:34
#, php-format
msgid "Unable to remove user from group %s"
msgstr ""

#: js/apps.js:28 js/apps.js:67
msgid "Disable"
msgstr "Slå av"

#: js/apps.js:28 js/apps.js:55
msgid "Enable"
msgstr "Slå på"

#: js/personal.js:69
msgid "Saving..."
msgstr ""

#: personal.php:42 personal.php:43
msgid "__language_name__"
msgstr "Nynorsk"

#: templates/apps.php:10
msgid "Add your App"
msgstr ""

#: templates/apps.php:11
msgid "More Apps"
msgstr ""

#: templates/apps.php:27
msgid "Select an App"
msgstr "Vel ein applikasjon"

#: templates/apps.php:31
msgid "See application page at apps.owncloud.com"
msgstr ""

#: templates/apps.php:32
msgid "<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>"
msgstr ""

#: templates/help.php:3
msgid "User Documentation"
msgstr ""

#: templates/help.php:4
msgid "Administrator Documentation"
msgstr ""

#: templates/help.php:6
msgid "Online Documentation"
msgstr ""

#: templates/help.php:7
msgid "Forum"
msgstr ""

#: templates/help.php:9
msgid "Bugtracker"
msgstr ""

#: templates/help.php:11
msgid "Commercial Support"
msgstr ""

#: templates/personal.php:8
#, php-format
msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>"
msgstr ""

#: templates/personal.php:12
msgid "Clients"
msgstr ""

#: templates/personal.php:13
msgid "Download Desktop Clients"
msgstr ""

#: templates/personal.php:14
msgid "Download Android Client"
msgstr ""

#: templates/personal.php:15
msgid "Download iOS Client"
msgstr ""

#: templates/personal.php:21 templates/users.php:23 templates/users.php:77
msgid "Password"
msgstr "Passord"

#: templates/personal.php:22
msgid "Your password was changed"
msgstr ""

#: templates/personal.php:23
msgid "Unable to change your password"
msgstr "Klarte ikkje å endra passordet"

#: templates/personal.php:24
msgid "Current password"
msgstr "Passord"

#: templates/personal.php:25
msgid "New password"
msgstr "Nytt passord"

#: templates/personal.php:26
msgid "show"
msgstr "vis"

#: templates/personal.php:27
msgid "Change password"
msgstr "Endra passord"

#: templates/personal.php:33
msgid "Email"
msgstr "Epost"

#: templates/personal.php:34
msgid "Your email address"
msgstr "Din epost addresse"

#: templates/personal.php:35
msgid "Fill in an email address to enable password recovery"
msgstr "Fyll inn din e-post addresse for og kunne motta passord tilbakestilling"

#: templates/personal.php:41 templates/personal.php:42
msgid "Language"
msgstr "Språk"

#: templates/personal.php:47
msgid "Help translate"
msgstr "Hjelp oss å oversett"

#: templates/personal.php:52
msgid "WebDAV"
msgstr ""

#: templates/personal.php:54
msgid "Use this address to connect to your ownCloud in your file manager"
msgstr ""

#: templates/personal.php:63
msgid "Version"
msgstr ""

#: templates/personal.php:65
msgid ""
"Developed by the <a href=\"http://ownCloud.org/contact\" "
"target=\"_blank\">ownCloud community</a>, the <a "
"href=\"https://github.com/owncloud\" target=\"_blank\">source code</a> is "
"licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" "
"target=\"_blank\"><abbr title=\"Affero General Public "
"License\">AGPL</abbr></a>."
msgstr ""

#: templates/users.php:21 templates/users.php:76
msgid "Name"
msgstr "Namn"

#: templates/users.php:26 templates/users.php:78 templates/users.php:98
msgid "Groups"
msgstr "Grupper"

#: templates/users.php:32
msgid "Create"
msgstr "Lag"

#: templates/users.php:35
msgid "Default Quota"
msgstr ""

#: templates/users.php:55 templates/users.php:138
msgid "Other"
msgstr "Anna"

#: templates/users.php:80 templates/users.php:112
msgid "Group Admin"
msgstr ""

#: templates/users.php:82
msgid "Quota"
msgstr "Kvote"

#: templates/users.php:146
msgid "Delete"
msgstr "Slett"