1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00
This commit is contained in:
Tino Vazquez 2022-06-30 16:49:48 +02:00
commit b3ad775829
6 changed files with 17 additions and 15 deletions

View File

@ -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`

View File

@ -78,10 +78,12 @@ const HistoryRecordCard = memo(
const { name: userName } = useGetUsersQuery(undefined, {
selectFromResult: ({ data }) => getNameFromResult(UID, data),
skip: UID === -1,
})
const { name: groupName } = useGetGroupsQuery(undefined, {
selectFromResult: ({ data }) => getNameFromResult(GID, data),
skip: UID === -1,
})
return (
@ -93,27 +95,27 @@ const HistoryRecordCard = memo(
<div className={classes.main}>
<div className={classes.title}>
<Typography noWrap component="span" data-cy="record-data">
{`#${SEQ} | #${HID} ${HOSTNAME} | ${Tr(T.Action)}: ${action}`}
{`${SEQ} | ${HID} ${HOSTNAME} | ${Tr(T.Action)}: ${action}`}
</Typography>
</div>
<div className={classes.caption}>
<span title={`${Tr(T.Datastore)}: #${DS_ID} ${dsName}`}>
<span title={`${Tr(T.Datastore)}: ${DS_ID} ${dsName}`}>
<Folder />
<span data-cy="datastore">{`#${DS_ID} ${dsName}`}</span>
<span data-cy="datastore">{dsName}</span>
</span>
{+UID !== -1 && (
<>
<span title={`${Tr(T.Owner)}: #${UID} ${userName}`}>
<span title={`${Tr(T.Owner)}: ${UID} ${userName}`}>
<User />
<span data-cy="owner">{`#${UID} ${userName}`}</span>
<span data-cy="owner">{userName}</span>
</span>
<span title={`${Tr(T.Group)}: #${GID} ${groupName}`}>
<span title={`${Tr(T.Group)}: ${GID} ${groupName}`}>
<Group />
<span data-cy="group">{`#${GID} ${groupName}`}</span>
<span data-cy="group">{groupName}</span>
</span>
<span title={`${Tr(T.RequestId)}: ${REQUEST_ID}`}>
<InfoEmpty />
<span data-cy="request">{`#${REQUEST_ID}`}</span>
<span data-cy="request">{REQUEST_ID}</span>
</span>
</>
)}

View File

@ -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 ?? {

View File

@ -573,7 +573,7 @@ module.exports = {
MemoryModification: 'Memory modification',
AllowUsersToModifyMemory:
"Allow users to modify this template's default memory on instantiate",
MemoryConcept: 'Amount of RAM required for the VM',
MemoryConcept: 'Amount of RAM required for the VM, in Megabytes',
CpuConcept: `
Percentage of CPU divided by 100 required for the
Virtual Machine. Half a processor is written 0.5`,

View File

@ -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 },
}

View File

@ -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,
})