Skip to content

Commit 098df9b

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

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
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('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('Deprecated, use @nextcloud/l10n instead.')
367+
return _getLanguage()
368+
}
361369

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

0 commit comments

Comments
 (0)