mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Avoid formatI18nField to fail if field is undefined
At the moment, it seems that if an app manifest custom argument is missing the "ask" property, the display of app install page is blank.
This commit is contained in:
parent
64ae24facd
commit
bf4d4d9266
1 changed files with 2 additions and 2 deletions
|
@ -8,13 +8,13 @@ import { isObjectLiteral, isEmptyValue, flattenObjectLiteral } from '@/helpers/c
|
|||
* Tries to find a translation corresponding to the user's locale/fallback locale in a
|
||||
* Yunohost argument or simply return the string if it's not an object literal.
|
||||
*
|
||||
* @param {(Object|String)} field - A field value containing a translation object or string
|
||||
* @param {(Object|String|undefined)} field - A field value containing a translation object or string
|
||||
* @return {String}
|
||||
*/
|
||||
export function formatI18nField (field) {
|
||||
if (typeof field === 'string') return field
|
||||
const { locale, fallbackLocale } = store.state
|
||||
return field[locale] || field[fallbackLocale] || field.en
|
||||
return field ? field[locale] || field[fallbackLocale] || field.en : ''
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue