Skip to content

Commit d5f9852

Browse files
committed
Use getLocale and getLanguage from nc-l10n
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 290697b commit d5f9852

File tree

7 files changed

+65
-9
lines changed

7 files changed

+65
-9
lines changed

core/src/OC/l10n.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import Handlebars from 'handlebars'
3535
import identity from 'lodash/fp/identity'
3636
import escapeHTML from 'escape-html'
3737
import { generateFilePath } from '@nextcloud/router'
38+
import { getLanguage as _getLanguage, getLocale as _getLocale } from '@nextcloud/l10n'
3839

3940
import OC from './index'
4041
import {
@@ -348,16 +349,23 @@ export default L10n
348349
/**
349350
* Returns the user's locale
350351
*
352+
* @deprecated use @nextcloud/l10n
351353
* @return {string} locale string
352354
*/
353-
export const getLocale = () => $('html').data('locale') ?? 'en'
354-
355+
export const getLocale = function() {
356+
console.warn('Calling OC.getLocale() is deprecated, use @nextcloud/l10n instead.')
357+
return _getLocale()
358+
}
355359
/**
356360
* Returns the user's language
357361
*
362+
* @deprecated use @nextcloud/l10n
358363
* @return {string} language string
359364
*/
360-
export const getLanguage = () => $('html').prop('lang')
365+
export const getLanguage = function() {
366+
console.warn('Calling OC.getLanguage() is deprecated, use @nextcloud/l10n instead.')
367+
return _getLanguage()
368+
}
361369

362370
Handlebars.registerHelper('t', function(app, text) {
363371
return L10n.translate(app, text)

dist/core-login.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-login.js.LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@
4646
*
4747
*/
4848

49+
/**
50+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
51+
*
52+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
53+
* @author John Molakvoæ <skjnldsv@protonmail.com>
54+
* @author rakekniven <mark.ziegler@rakekniven.de>
55+
*
56+
* @license AGPL-3.0-or-later
57+
*
58+
* This program is free software: you can redistribute it and/or modify
59+
* it under the terms of the GNU Affero General Public License as
60+
* published by the Free Software Foundation, either version 3 of the
61+
* License, or (at your option) any later version.
62+
*
63+
* This program is distributed in the hope that it will be useful,
64+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
65+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66+
* GNU Affero General Public License for more details.
67+
*
68+
* You should have received a copy of the GNU Affero General Public License
69+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
70+
*
71+
*/
72+
4973
/**
5074
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
5175
* @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>

dist/core-login.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-main.js.LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,30 @@
216216
*
217217
*/
218218

219+
/**
220+
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
221+
*
222+
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
223+
* @author John Molakvoæ <skjnldsv@protonmail.com>
224+
* @author rakekniven <mark.ziegler@rakekniven.de>
225+
*
226+
* @license AGPL-3.0-or-later
227+
*
228+
* This program is free software: you can redistribute it and/or modify
229+
* it under the terms of the GNU Affero General Public License as
230+
* published by the Free Software Foundation, either version 3 of the
231+
* License, or (at your option) any later version.
232+
*
233+
* This program is distributed in the hope that it will be useful,
234+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
235+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236+
* GNU Affero General Public License for more details.
237+
*
238+
* You should have received a copy of the GNU Affero General Public License
239+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
240+
*
241+
*/
242+
219243
/**
220244
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
221245
* @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>

dist/core-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)