mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
M #~: Minor fix to datetime translate (#2210)
(cherry picked from commit eac84bf27d5aec13c9e536faa3601f62a24874e8)
This commit is contained in:
parent
0274dc5c05
commit
d21400cc45
@ -24,6 +24,7 @@ import {
|
||||
} from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import root from 'window-or-global'
|
||||
import { Settings } from 'luxon'
|
||||
import { sprintf } from 'sprintf-js'
|
||||
|
||||
import { useAuth } from 'client/features/Auth'
|
||||
@ -93,6 +94,7 @@ const TranslateProvider = ({ children = [] }) => {
|
||||
if (!lang || !LANGUAGES[lang]) return
|
||||
|
||||
try {
|
||||
Settings.defaultLocale = lang.replace('_', '-')
|
||||
const script = root.document.createElement('script', {})
|
||||
|
||||
script.src = `${LANGUAGES_URL}/${lang}.js`
|
||||
|
@ -59,7 +59,6 @@ export const SCHEMES = Setting.SCHEMES
|
||||
export const DEFAULT_SCHEME = Setting.SCHEMES.SYSTEM
|
||||
|
||||
export const CURRENCY = SERVER_CONFIG?.currency ?? 'EUR'
|
||||
export const LOCALE = SERVER_CONFIG?.lang?.replace('_', '-') ?? undefined
|
||||
export const DEFAULT_LANGUAGE = SERVER_CONFIG?.default_lang ?? 'en'
|
||||
export const LANGUAGES_URL = `${STATIC_FILES_URL}/languages`
|
||||
export const LANGUAGES = SERVER_CONFIG.langs ?? {
|
||||
|
@ -61,7 +61,7 @@ const DISABLE_ANIMATIONS_FIELD = {
|
||||
name: 'DISABLE_ANIMATIONS',
|
||||
label: T.DisableDashboardAnimations,
|
||||
type: INPUT_TYPES.CHECKBOX,
|
||||
validation: boolean(),
|
||||
validation: boolean().yesOrNo(),
|
||||
grid: { md: 12 },
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and *
|
||||
* limitations under the License. *
|
||||
* ------------------------------------------------------------------------- */
|
||||
import { DateTime } from 'luxon'
|
||||
import { DateTime, Settings } from 'luxon'
|
||||
import {
|
||||
parse as ParserToJson,
|
||||
X2jOptions,
|
||||
@ -28,7 +28,6 @@ import {
|
||||
UserInputObject,
|
||||
USER_INPUT_TYPES,
|
||||
CURRENCY,
|
||||
LOCALE,
|
||||
} from 'client/constants'
|
||||
|
||||
/**
|
||||
@ -91,7 +90,7 @@ export const stringToBoolean = (str) =>
|
||||
*/
|
||||
export const formatNumberByCurrency = (number, options) => {
|
||||
try {
|
||||
return Intl.NumberFormat(LOCALE, {
|
||||
return Intl.NumberFormat(Settings.defaultLocale, {
|
||||
style: 'currency',
|
||||
currency: CURRENCY,
|
||||
currencyDisplay: 'narrowSymbol',
|
||||
@ -116,7 +115,7 @@ export const formatNumberByCurrency = (number, options) => {
|
||||
*/
|
||||
export const areStringEqual = (options) => (a, b) => {
|
||||
try {
|
||||
const collator = new Intl.Collator(LOCALE, {
|
||||
const collator = new Intl.Collator(Settings.defaultLocale, {
|
||||
sensitivity: 'base',
|
||||
...options,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user