Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use getLocale and getLanguage from @nc-l10n #32257

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions core/src/OC/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Handlebars from 'handlebars'
import identity from 'lodash/fp/identity'
import escapeHTML from 'escape-html'
import { generateFilePath } from '@nextcloud/router'
import { getLanguage as _getLanguage, getLocale as _getLocale } from '@nextcloud/l10n'

import OC from './index'
import {
Expand Down Expand Up @@ -348,16 +349,23 @@ export default L10n
/**
* Returns the user's locale
*
* @deprecated use @nextcloud/l10n
* @return {string} locale string
*/
export const getLocale = () => $('html').data('locale') ?? 'en'

export const getLocale = function() {
console.warn('Calling OC.getLocale() is deprecated, use @nextcloud/l10n instead.')
return _getLocale()
}
/**
* Returns the user's language
*
* @deprecated use @nextcloud/l10n
* @return {string} language string
*/
export const getLanguage = () => $('html').prop('lang')
export const getLanguage = function() {
console.warn('Calling OC.getLanguage() is deprecated, use @nextcloud/l10n instead.')
return _getLanguage()
}

Handlebars.registerHelper('t', function(app, text) {
return L10n.translate(app, text)
Expand Down
4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions dist/core-login.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@
*
*/

/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author rakekniven <mark.ziegler@rakekniven.de>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
Expand Down
2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions dist/core-main.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,30 @@
*
*/

/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author rakekniven <mark.ziegler@rakekniven.de>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
Expand Down
2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.