From eaf4724acc3b4720239d789f6028526945b8bba0 Mon Sep 17 00:00:00 2001
From: Christoph Wurst <christoph@winzerhof-wurst.at>
Date: Thu, 4 Jun 2020 10:52:03 +0200
Subject: Move humanFileSize and OC.getCanonicalLocale to npm packages

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
---
 core/src/OC/index.js |  6 ++++--
 core/src/OC/l10n.js  | 10 ----------
 core/src/OC/util.js  |  5 ++++-
 3 files changed, 8 insertions(+), 13 deletions(-)

(limited to 'core/src/OC')

diff --git a/core/src/OC/index.js b/core/src/OC/index.js
index 59abe046769..6a5850919cc 100644
--- a/core/src/OC/index.js
+++ b/core/src/OC/index.js
@@ -79,10 +79,12 @@ import {
 } from './menu'
 import { isUserAdmin } from './admin'
 import L10N, {
-	getCanonicalLocale,
 	getLanguage,
 	getLocale,
 } from './l10n'
+import {
+	getCanonicalLocale,
+} from '@nextcloud/l10n'
 
 import {
 	generateUrl,
@@ -223,7 +225,7 @@ export default {
 	getProtocol,
 
 	/**
-	 * L10n
+	 * @deprecated 20.0.0 use `getCanonicalLocale` from https://www.npmjs.com/package/@nextcloud/l10n
 	 */
 	getCanonicalLocale,
 	getLocale,
diff --git a/core/src/OC/l10n.js b/core/src/OC/l10n.js
index a4920e9d271..8eeb978b6d9 100644
--- a/core/src/OC/l10n.js
+++ b/core/src/OC/l10n.js
@@ -323,16 +323,6 @@ const L10n = {
 
 export default L10n
 
-/**
- * Returns the user's locale as a BCP 47 compliant language tag
- *
- * @returns {String} locale string
- */
-export const getCanonicalLocale = () => {
-	const locale = getLocale()
-	return typeof locale === 'string' ? locale.replace(/_/g, '-') : locale
-}
-
 /**
  * Returns the user's locale
  *
diff --git a/core/src/OC/util.js b/core/src/OC/util.js
index 67f00bf30d3..a8666808083 100644
--- a/core/src/OC/util.js
+++ b/core/src/OC/util.js
@@ -24,7 +24,7 @@ import moment from 'moment'
 
 import History from './util-history'
 import OC from './index'
-import humanFileSize from '../Util/human-file-size'
+import { formatFileSize as humanFileSize } from '@nextcloud/files'
 
 function chunkify(t) {
 	// Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288
@@ -58,6 +58,9 @@ export default {
 
 	History,
 
+	/**
+	 * @deprecated use https://nextcloud.github.io/nextcloud-files/modules/_humanfilesize_.html#formatfilesize
+	 */
 	humanFileSize,
 
 	/**
-- 
cgit v1.2.3