change default form labels

This commit is contained in:
zombieFox 2024-06-14 00:46:00 +01:00
parent 2c78455fd7
commit 515a8cc3b1
30 changed files with 195 additions and 159 deletions

View File

@ -771,8 +771,8 @@ export const BookmarkForm = function({
form.wrap({
children: [
node('div|class:bookmark-form-description', [
node(`h2:${message.get('bookmarkFormSectionVisualHeading')}`),
node(`p:${message.get('bookmarkFormSectionVisualDescription')}`)
node(`h2:${message.get('bookmarkFormSectionVisualHeading') || 'Content'}`),
node(`p:${message.get('bookmarkFormSectionVisualDescription') || 'Text'}`)
])
]
}),
@ -801,8 +801,8 @@ export const BookmarkForm = function({
form.wrap({
children: [
node('div|class:bookmark-form-description', [
node(`h2:${message.get('bookmarkFormSectionAddressHeading')}`),
complexNode({ tag: 'p', text: message.get('bookmarkFormSectionAddressDescription'), complexText: true })
node(`h2:${message.get('bookmarkFormSectionAddressHeading') || 'Content'}`),
complexNode({ tag: 'p', text: message.get('bookmarkFormSectionAddressDescription') || 'Text', complexText: true })
])
]
}),
@ -825,8 +825,8 @@ export const BookmarkForm = function({
form.wrap({
children: [
node('div|class:bookmark-form-description', [
node(`h2:${message.get('bookmarkFormSectionPositionHeading')}`),
node(`p:${message.get('bookmarkFormSectionPositionDescription')}`)
node(`h2:${message.get('bookmarkFormSectionPositionHeading') || 'Content'}`),
node(`p:${message.get('bookmarkFormSectionPositionDescription') || 'Text'}`)
])
]
}),
@ -870,8 +870,8 @@ export const BookmarkForm = function({
form.wrap({
children: [
node('div|class:bookmark-form-description', [
node(`h2:${message.get('bookmarkFormSectionLayoutHeading')}`),
node(`p:${message.get('bookmarkFormSectionLayoutDescription')}`)
node(`h2:${message.get('bookmarkFormSectionLayoutHeading') || 'Content'}`),
node(`p:${message.get('bookmarkFormSectionLayoutDescription') || 'Text'}`)
])
]
}),
@ -917,8 +917,8 @@ export const BookmarkForm = function({
form.wrap({
children: [
node('div|class:bookmark-form-description', [
node(`h2:${message.get('bookmarkFormSectionThemeHeading')}`),
node(`p:${message.get('bookmarkFormSectionThemeDescription')}`)
node(`h2:${message.get('bookmarkFormSectionThemeHeading') || 'Content'}`),
node(`p:${message.get('bookmarkFormSectionThemeDescription') || 'Text'}`)
])
]
}),

View File

@ -7,7 +7,7 @@ export const Control_checkbox = function ({
object = {},
id = 'name',
path = false,
labelText = 'name',
labelText = 'Label',
description = false,
action = false,
//FIXME deprecated properties

View File

@ -13,7 +13,7 @@ export const Control_color = function ({
object = {},
path = false,
id = 'name',
labelText = 'Name',
labelText = 'Label',
srOnly = false,
//FIXME deprecated property
value = '#000000', //eslint-disable-line

View File

@ -19,7 +19,7 @@ export const Control_colorMixer = function ({
defaultValue = false,
minMaxObject = false,
id = 'name',
labelText = 'name',
labelText = 'Label',
srOnly = false,
randomColor = false,
action = false

View File

@ -10,7 +10,7 @@ export const Control_helperText = function ({
text.forEach((item) => {
this.para.push(form.helper({
tag: 'p',
text: item,
text: item || 'Text',
complexText: complexText
}));
});

View File

@ -12,7 +12,7 @@ export const Control_inputButton = function ({
inputButtonClassList = [],
type = false,
inputHide = false,
labelText = 'Name',
labelText = 'Label',
srOnly = false,
inputButtonStyle = [],
action = false

View File

@ -1,7 +1,7 @@
import * as form from '../../form';
export const Control_label = function({
text = 'label',
text = 'Label',
description = false,
srOnly = false,
icon = false,

View File

@ -7,7 +7,7 @@ export const Control_radio = function ({
radioGroup = [],
object = {},
label = false,
groupName = 'group',
groupName = 'Group',
path = false,
action = false,
inputButton = false,

View File

@ -5,7 +5,7 @@ import { set } from '../../../utility/set';
export const Control_radioGrid = function ({
radioGroup = [],
label = false,
label = 'Label',
object = {},
groupName = 'group',
path = false,

View File

@ -12,7 +12,7 @@ export const Control_select = function({
object = {},
id = 'name',
path = false,
labelText = 'name',
labelText = 'Label',
srOnly = false,
description = false,
action = false

View File

@ -12,7 +12,7 @@ export const Control_slider = function({
object = {},
path = false,
id = 'name',
labelText = 'Name',
labelText = 'Label',
value = 0,
defaultValue = false,
min = 0,

View File

@ -10,12 +10,12 @@ import { set } from '../../../utility/set';
export const Control_sliderDouble = function ({
object = {},
labelText = 'Name',
labelText = 'Label',
style = false,
left = {
path: false,
id: 'name',
labelText: 'Name',
labelText: 'Label',
hue: false,
value: 0,
defaultValue: false,
@ -34,7 +34,7 @@ export const Control_sliderDouble = function ({
right = {
path: false,
id: 'name',
labelText: 'Name',
labelText: 'Label',
hue: false,
value: 0,
defaultValue: false,

View File

@ -12,7 +12,7 @@ export const Control_sliderSlim = function({
object = {},
path = false,
id = 'name',
labelText = 'Name',
labelText = 'Label',
hue = false,
value = 0,
defaultValue = false,

View File

@ -12,7 +12,7 @@ export const Control_text = function ({
max = false,
placeholder = false,
classList = [],
labelText = 'Name',
labelText = 'Label',
srOnly = false,
action = false
} = {}) {

View File

@ -17,7 +17,7 @@ export const Control_textReset = function({
max = false,
placeholder = false,
classList = [],
labelText = 'Name',
labelText = 'Label',
srOnly = false,
action = false
} = {}) {

View File

@ -12,7 +12,7 @@ export const Control_textarea = function ({
max = false,
placeholder = false,
classList = [],
labelText = 'Name',
labelText = 'Label',
srOnly = false,
action = false
} = {}) {

View File

@ -384,7 +384,7 @@ data.feedback = {};
data.feedback.empty = {
render: (feedback) => {
feedback.appendChild(node(`p:${message.get('dataFeedbackEmpty')}|class:muted small`));
feedback.appendChild(node(`p:${message.get('dataFeedbackEmpty') || 'Text'}|class:muted small`));
}
};

View File

@ -6,7 +6,7 @@ import { node } from '../../utility/node';
import './index.css';
export const DropFile = function ({
heading = 'Drop file here',
heading = 'Text',
dropAaction = false,
enterAction = false,
leaveAction = false,

View File

@ -4,7 +4,7 @@ import { complexNode } from '../../../utility/complexNode';
import './index.css';
export const feedback = ({
text = false
text = 'Text'
} = {}) => {
const feedback = node('div|class:form-feedback');

View File

@ -3,7 +3,7 @@ import { node } from '../../../utility/node';
import './index.css';
export const helper = function ({
text = 'text',
text = 'Text',
complexText = false,
classList = []
} = {}) {

View File

@ -4,7 +4,7 @@ import './index.css';
export const label = ({
forInput = false,
text = 'label',
text = 'Label',
description = false,
srOnly = false,
icon = false,
@ -42,12 +42,12 @@ export const label = ({
if (Array.isArray(description)) {
description.forEach((item) => {
labelBlock.appendChild(node('span:' + item + '|class:label-block-item small muted'));
labelBlock.appendChild(node('span:' + (item || 'Description') + '|class:label-block-item small muted'));
});
} else if (typeof description === 'string') {
labelBlock.appendChild(node('span:' + description + '|class:label-block-item small muted'));
labelBlock.appendChild(node('span:' + (description || 'Description') + '|class:label-block-item small muted'));
}
}

View File

@ -141,8 +141,8 @@ export const GroupForm = function({
form.wrap({
children: [
node('div|class:group-form-description', [
node(`h2:${message.get('groupFormSectionNameHeading')}`),
node(`p:${message.get('groupFormSectionNameDescription')}`)
node(`h2:${message.get('groupFormSectionNameHeading') || 'Content'}`),
node(`p:${message.get('groupFormSectionNameDescription') || 'Text'}`)
])
]
}),
@ -179,8 +179,8 @@ export const GroupForm = function({
form.wrap({
children: [
node('div|class:group-form-description', [
node(`h2:${message.get('groupFormSectionToolbarHeading')}`),
node(`p:${message.get('groupFormSectionToolbarDescription')}`)
node(`h2:${message.get('groupFormSectionToolbarHeading') || 'Content'}`),
node(`p:${message.get('groupFormSectionToolbarDescription') || 'Text'}`)
])
]
}),
@ -208,8 +208,8 @@ export const GroupForm = function({
form.wrap({
children: [
node('div|class:group-form-description', [
node(`h2:${message.get('groupFormSectionOrderingHeading')}`),
node(`p:${message.get('groupFormSectionOrderingDescription')}`)
node(`h2:${message.get('groupFormSectionOrderingHeading') || 'Content'}`),
node(`p:${message.get('groupFormSectionOrderingDescription') || 'Text'}`)
])
]
}),

View File

@ -46,6 +46,10 @@ export const Link = function ({
this.element.link.classList.add('button-ring');
break;
case 'small':
this.element.link.classList.add('button-small');
break;
}
});

View File

@ -13,7 +13,7 @@ const appSetting = {};
appSetting.app = (parent) => {
appSetting.app.para1 = node(`p:${message.get('menuContentAppPara1')}`);
appSetting.app.para1 = node(`p:${message.get('menuContentAppPara1') || 'Text'}`);
appSetting.app.link1 = new Link({
text: message.get('menuContentAppLink1'),
@ -21,7 +21,7 @@ appSetting.app = (parent) => {
openNew: true
});
appSetting.app.para2 = node(`p:${message.get('menuContentAppPara2')}`);
appSetting.app.para2 = node(`p:${message.get('menuContentAppPara2') || 'Text'}`);
appSetting.app.link2 = new Link({
text: message.get('menuContentAppLink2'),

View File

@ -160,7 +160,7 @@ dataSetting.clear = (parent) => {
dataSetting.control.clear.alert = new Alert({
iconName: 'warning',
children: [
node(`p:${message.get('menuContentDataClearAlertPara')}|class:small`),
node(`p:${message.get('menuContentDataClearAlertPara') || 'Text'}|class:small`),
node('p|class:small', dataSetting.control.clear.link.link())
]
});

View File

@ -29,7 +29,7 @@ export const MenuContent = function({
},
header: (name) => {
return node('div|class:menu-item-header', [
node('h1:' + name + '|class:menu-item-header-text')
node('h1:' + (name || 'Content') + '|class:menu-item-header-text')
]);
},
form: ({ indent = false } = {}) => {

View File

@ -99,7 +99,7 @@ supportSetting.support = (parent) => {
supportSetting.support.para = node('p');
supportSetting.support.para.innerHTML = message.get('menuContentSupportPara');
supportSetting.support.para.innerHTML = message.get('menuContentSupportPara') || 'Text';
supportSetting.support.linkIssue = new Link({
text: message.get('menuContentSupportLink1'),

View File

@ -1,6 +1,7 @@
import { message } from '../message';
import { Button } from '../button';
import { Link } from '../link';
import { node } from '../../utility/node';
import { uppercaseFirstLetter } from '../../utility/uppercaseFirstLetter';
@ -153,11 +154,17 @@ export const MenuNav = function({
item.sub.forEach((item) => {
const subLevelLink = node('a:' + message.get(`menuNav${uppercaseFirstLetter(navTop)}SubNav${uppercaseFirstLetter(item)}`) + '|href:#menu-content-item-' + this.makeId(item) + ',class:menu-nav-sub button button-link button-small,tabindex:1');
const subLevelLink = new Link({
text: message.get(`menuNav${uppercaseFirstLetter(navTop)}SubNav${uppercaseFirstLetter(item)}`),
href: '#menu-content-item-' + this.makeId(item),
linkButton: true,
style: ['link', 'small'],
classList: ['menu-nav-sub']
});
subNav.appendChild(subLevelLink);
subNav.appendChild(subLevelLink.link());
navItem.subLevelItem.push(subLevelLink);
navItem.subLevelItem.push(subLevelLink.link());
});

View File

@ -1,141 +1,166 @@
import { APP_NAME } from '../../constant';
import { state } from '../state';
import { browserDetect } from '../browserDetect';
import { default as bn } from '../../locale/bn/messages.json';
import { default as de } from '../../locale/de/messages.json';
import { default as en_GB } from '../../locale/en_GB/messages.json';
import { default as en_US } from '../../locale/en_US/messages.json';
import { default as es } from '../../locale/es/messages.json';
import { default as fil } from '../../locale/fil/messages.json';
import { default as fr } from '../../locale/fr/messages.json';
import { default as gu } from '../../locale/gu/messages.json';
import { default as hi } from '../../locale/hi/messages.json';
import { default as id } from '../../locale/id/messages.json';
import { default as it } from '../../locale/it/messages.json';
import { default as ja } from '../../locale/ja/messages.json';
import { default as ms } from '../../locale/ms/messages.json';
import { default as pt } from '../../locale/pt/messages.json';
import { default as ru } from '../../locale/ru/messages.json';
import { default as uk } from '../../locale/uk/messages.json';
import { default as vi } from '../../locale/vi/messages.json';
// import { default as bn } from '../../locale/bn/messages.json';
// import { default as de } from '../../locale/de/messages.json';
// import { default as en_GB } from '../../locale/en_GB/messages.json';
// import { default as en_US } from '../../locale/en_US/messages.json';
// import { default as es } from '../../locale/es/messages.json';
// import { default as fil } from '../../locale/fil/messages.json';
// import { default as fr } from '../../locale/fr/messages.json';
// import { default as gu } from '../../locale/gu/messages.json';
// import { default as hi } from '../../locale/hi/messages.json';
// import { default as id } from '../../locale/id/messages.json';
// import { default as it } from '../../locale/it/messages.json';
// import { default as ja } from '../../locale/ja/messages.json';
// import { default as ms } from '../../locale/ms/messages.json';
// import { default as pt } from '../../locale/pt/messages.json';
// import { default as ru } from '../../locale/ru/messages.json';
// import { default as uk } from '../../locale/uk/messages.json';
// import { default as vi } from '../../locale/vi/messages.json';
const message = {};
message.language = {
pack: { bn, de, en_GB, en_US, es, fil, fr, gu, hi, id, it, ja, ms, pt, ru, uk, vi }
// pack: { bn, de, en_GB, en_US, es, fil, fr, gu, hi, id, it, ja, ms, pt, ru, uk, vi }
};
message.language.list = () => {
// message.language.list = () => {
//
// const list = [
// { code: 'bn', name: 'বাংলা' }, // Bengali
// { code: 'de', name: 'Deutsch' }, // German
// { code: 'en_GB', name: 'English' }, // English GB
// { code: 'en_US', name: 'English' }, // English USA
// { code: 'es', name: 'Español' }, // Spanish
// { code: 'fil', name: 'Filipino' }, // Filipino
// { code: 'fr', name: 'Français' }, // French
// { code: 'gu', name: 'ગુજરાતી' }, // Gujarati
// { code: 'hi', name: 'हिंदी' }, // Hindi
// { code: 'id', name: 'Indonesia' }, // Indonesian
// { code: 'it', name: 'Italiano' }, // Italian
// { code: 'ja', name: '日本語' }, // Japanese
// { code: 'ms', name: 'Melayu' }, // Malay
// { code: 'pt', name: 'Português' }, // Portuguese
// { code: 'ru', name: 'Pусский' }, // Russian
// { code: 'uk', name: 'український' }, // Ukrainian
// { code: 'vi', name: 'англійська' } // Vietnamese
// ];
//
// list.forEach((item) => {
//
// if (item.code.indexOf('_') > -1) {
// item.name = `${item.name} — ${(item.code.substring(0, item.code.indexOf('_'))).toUpperCase()} (${item.code.substring(item.code.indexOf('_') + 1, item.code.length)})`;
// } else {
// item.name = `${item.name} — ${(item.code).toUpperCase()}`;
// }
//
// });
//
// list.unshift({ name: '—', disabled: true });
//
// list.unshift({ code: 'system', name: message.get('menuContentLanguageSystem') });
//
// return list;
//
// };
const list = [
{ code: 'bn', name: 'বাংলা' }, // Bengali
{ code: 'de', name: 'Deutsch' }, // German
{ code: 'en_GB', name: 'English' }, // English GB
{ code: 'en_US', name: 'English' }, // English USA
{ code: 'es', name: 'Español' }, // Spanish
{ code: 'fil', name: 'Filipino' }, // Filipino
{ code: 'fr', name: 'Français' }, // French
{ code: 'gu', name: 'ગુજરાતી' }, // Gujarati
{ code: 'hi', name: 'हिंदी' }, // Hindi
{ code: 'id', name: 'Indonesia' }, // Indonesian
{ code: 'it', name: 'Italiano' }, // Italian
{ code: 'ja', name: '日本語' }, // Japanese
{ code: 'ms', name: 'Melayu' }, // Malay
{ code: 'pt', name: 'Português' }, // Portuguese
{ code: 'ru', name: 'Pусский' }, // Russian
{ code: 'uk', name: 'український' }, // Ukrainian
{ code: 'vi', name: 'англійська' } // Vietnamese
];
// message.language.name = () => message.language.list().map(item => item.name);
list.forEach((item) => {
if (item.code.indexOf('_') > -1) {
item.name = `${item.name}${(item.code.substring(0, item.code.indexOf('_'))).toUpperCase()} (${item.code.substring(item.code.indexOf('_') + 1, item.code.length)})`;
} else {
item.name = `${item.name}${(item.code).toUpperCase()}`;
}
});
list.unshift({ name: '—', disabled: true });
list.unshift({ code: 'system', name: message.get('menuContentLanguageSystem') });
return list;
};
message.language.name = () => message.language.list().map(item => item.name);
message.language.code = () => message.language.list().map(item => item.code);
// message.language.code = () => message.language.list().map(item => item.code);
message.get = (stringId) => {
let string;
switch (state.get.current().language) {
if (browserDetect().chrome && typeof chrome != 'undefined') {
// if browser is chrome
// use system language
case 'system':
if ('i18n' in chrome) {
// if installed as extension
if (browserDetect().chrome && typeof chrome != 'undefined') {
// if browser is chrome
string = chrome.i18n.getMessage(stringId);
if ('i18n' in chrome) {
// if installed as extension
}
string = chrome.i18n.getMessage(stringId);
} else if (browserDetect().firefox && typeof browser != 'undefined') {
// if browser is firefox
} else {
if ('i18n' in browser) {
// if installed as addon
string = message.language.pack.en_GB[stringId].message;
string = browser.i18n.getMessage(stringId);
}
}
} else if (browserDetect().firefox && typeof browser != 'undefined') {
// if browser is firefox
} else {
if ('i18n' in browser) {
// if installed as addon
string = browser.i18n.getMessage(stringId);
} else {
string = message.language.pack.en_GB[stringId].message;
}
} else {
string = message.language.pack.en_GB[stringId].message;
}
break;
// use manually selected language
default:
if (stringId in message.language.pack[state.get.current().language]) {
// string found in chosen language
string = message.language.pack[state.get.current().language][stringId].message;
} else {
// or use default language
string = message.language.pack.en_GB[stringId].message;
}
break;
string = message.language.pack.en_GB[stringId].message;
}
if (string.indexOf('{appName}') > -1) {
// switch (state.get.current().language) {
//
// // use system language
// case 'system':
//
// if (browserDetect().chrome && typeof chrome != 'undefined') {
// // if browser is chrome
//
// if ('i18n' in chrome) {
// // if installed as extension
//
// string = chrome.i18n.getMessage(stringId);
//
// } else {
//
// string = message.language.pack.en_GB[stringId].message;
//
// }
//
// } else if (browserDetect().firefox && typeof browser != 'undefined') {
// // if browser is firefox
//
// if ('i18n' in browser) {
// // if installed as addon
//
// string = browser.i18n.getMessage(stringId);
//
// } else {
//
// string = message.language.pack.en_GB[stringId].message;
//
// }
//
// } else {
//
// string = message.language.pack.en_GB[stringId].message;
//
// }
//
// break;
//
// // use manually selected language
// default:
//
// if (stringId in message.language.pack[state.get.current().language]) {
//
// // string found in chosen language
// string = message.language.pack[state.get.current().language][stringId].message;
//
// } else {
//
// // or use default language
// string = message.language.pack.en_GB[stringId].message;
//
// }
//
// break;
//
// }
if (string && string.indexOf('{appName}') > -1) {
string = string.replaceAll('{appName}', APP_NAME);
@ -145,4 +170,4 @@ message.get = (stringId) => {
};
export { message };
export { message };

View File

@ -3,7 +3,7 @@
"short_name": "__MSG_appShortName__",
"description": "__MSG_appDescription__",
"version": "7.5.0",
"manifest_version": 2,
"manifest_version": 3,
"default_locale": "en_GB",
"chrome_url_overrides": {
"newtab": "index.html"