Merge pull request #367 from incubateur-territoires/translation-key-migration

Translation key migration
This commit is contained in:
jarek
2023-01-03 16:33:50 +01:00
committed by GitHub
83 changed files with 2445 additions and 1928 deletions

View File

@@ -10,7 +10,7 @@ import {BindableValue, Computed, Disposable, dom, Observable, onKeyDown, styled}
import {defaultMenuOptions, IOpenController, setPopupToCreateDom} from 'popweasel';
import {makeT} from 'app/client/lib/localization';
const t = makeT('ui2018.ColorSelect');
const t = makeT('ColorSelect');
export interface StyleOptions {
textColor: ColorOption,
@@ -64,7 +64,7 @@ export function colorSelect(
onSave,
onOpen,
onRevert,
placeholder = t('DefaultCellStyle'),
placeholder = t("Default cell style"),
} = options;
const selectBtn = cssSelectBtn(
cssContent(
@@ -188,12 +188,12 @@ function buildColorPicker(ctl: IOpenController,
}),
cssButtonRow(
primaryButton(t('Apply'),
primaryButton(t("Apply"),
dom.on('click', () => ctl.close()),
dom.boolAttr("disabled", notChanged),
testId('colors-save')
),
basicButton(t('Cancel'),
basicButton(t("Cancel"),
dom.on('click', () => revert()),
testId('colors-cancel')
)

View File

@@ -14,7 +14,7 @@ import { cssLink } from 'app/client/ui2018/links';
import { BindableValue, dom, Observable, styled } from 'grainjs';
import { tooltip } from 'popweasel';
const t = makeT('ui2018.breadcrumbs');
const t = makeT('breadcrumbs');
export const cssBreadcrumbs = styled('div', `
color: ${theme.lightText};
@@ -138,19 +138,20 @@ export function docBreadcrumbs(
dom.maybe(options.isPublic, () => cssPublicIcon('PublicFilled', testId('bc-is-public'))),
dom.domComputed((use) => {
if (options.isSnapshot && use(options.isSnapshot)) {
return cssTag(t('Snapshot'), testId('snapshot-tag'));
return cssTag(t("snapshot"), testId('snapshot-tag'));
}
if (use(options.isFork)) {
return cssTag(t('Unsaved'), testId('unsaved-tag'));
return cssTag(t("unsaved"), testId('unsaved-tag'));
}
if (use(options.isRecoveryMode)) {
return cssAlertTag(t('RecoveryMode'),
return cssAlertTag(t("recovery mode"),
dom('a', dom.on('click', () => options.cancelRecoveryMode()),
icon('CrossSmall')),
testId('recovery-mode-tag'));
}
if (use(options.isFiddle)) {
return cssTag(t('Fiddle'), tooltip({title: t('FiddleExplanation')}), testId('fiddle-tag'));
return cssTag(t("fiddle"), tooltip({title: t(`You may make edits, but they will create a new copy and will
not affect the original document.`)}), testId('fiddle-tag'));
}
}),
separator(' / ',

View File

@@ -11,7 +11,7 @@ import { BindableValue, Computed, dom, DomElementArg, DomElementMethod, IDomArgs
MaybeObsArray, MutableObsArray, Observable, styled } from 'grainjs';
import * as weasel from 'popweasel';
const t = makeT('ui2018.menus');
const t = makeT('menus');
export interface IOptionFull<T> {
value: T;
@@ -189,7 +189,7 @@ export function multiSelect<T>(selectedOptions: MutableObsArray<T>,
const selectedOptionsText = Computed.create(null, selectedOptionsSet, (use, selectedOpts) => {
if (selectedOpts.size === 0) {
return options.placeholder ?? t('SelectFields');
return options.placeholder ?? t("Select fields");
}
const optionArray = Array.isArray(availableOptions) ? availableOptions : use(availableOptions);
@@ -323,8 +323,8 @@ export function upgradableMenuItem(needUpgrade: boolean, action: () => void, ...
export function upgradeText(needUpgrade: boolean, onClick: () => void) {
if (!needUpgrade) { return null; }
return menuText(dom('span', t('WorkspacesAvailableOnTeamPlans'),
cssUpgradeTextButton(t('UpgradeNow'), dom.on('click', () => onClick()))));
return menuText(dom('span', t("* Workspaces are available on team plans. "),
cssUpgradeTextButton(t("Upgrade now"), dom.on('click', () => onClick()))));
}
/**

View File

@@ -12,7 +12,7 @@ import {Computed, Disposable, dom, DomContents, DomElementArg, input, keyframes,
MultiHolder, Observable, styled} from 'grainjs';
import {cssMenuElem} from 'app/client/ui2018/menus';
const t = makeT('ui2018.modals');
const t = makeT('modals');
// IModalControl is passed into the function creating the body of the modal.
export interface IModalControl {
@@ -306,13 +306,13 @@ export function saveModal(createFunc: (ctl: IModalControl, owner: MultiHolder) =
cssModalTitle(options.title, testId('modal-title')),
cssModalBody(options.body),
cssModalButtons(
bigPrimaryButton(options.saveLabel || t('Save'),
bigPrimaryButton(options.saveLabel || t("Save"),
dom.boolAttr('disabled', isSaveDisabled),
dom.on('click', save),
testId('modal-confirm'),
),
options.extraButtons,
options.hideCancel ? null : bigBasicButton(t('Cancel'),
options.hideCancel ? null : bigBasicButton(t("Cancel"),
dom.on('click', () => ctl.close()),
testId('modal-cancel'),
),
@@ -426,7 +426,7 @@ export function invokePrompt(
const prom = new Promise<string|undefined>((resolve) => {
onResolve = resolve;
});
promptModal(title, onResolve!, btnText ?? t('Ok'), initial, placeholder, () => {
promptModal(title, onResolve!, btnText ?? t("Ok"), initial, placeholder, () => {
if (onResolve) {
onResolve(undefined);
}

View File

@@ -8,7 +8,7 @@ import { hoverTooltip } from 'app/client/ui/tooltips';
import { menu, menuItem, menuText } from "app/client/ui2018/menus";
import { dom, domComputed, DomElementArg, makeTestId, observable, Observable, styled } from "grainjs";
const t = makeT('ui2018.pages');
const t = makeT('pages');
const testId = makeTestId('test-docpage-');
@@ -37,11 +37,11 @@ export function buildPageDom(name: Observable<string>, actions: PageActions, ...
const pageMenu = () => [
menuItem(() => isRenaming.set(true), t("Rename"), testId('rename'),
dom.cls('disabled', actions.isReadonly)),
menuItem(actions.onRemove, t('Remove'), testId('remove'),
menuItem(actions.onRemove, t("Remove"), testId('remove'),
dom.cls('disabled', (use) => use(actions.isReadonly) || actions.isRemoveDisabled())),
menuItem(actions.onDuplicate, t('DuplicatePage'), testId('duplicate'),
menuItem(actions.onDuplicate, t("Duplicate Page"), testId('duplicate'),
dom.cls('disabled', actions.isReadonly)),
dom.maybe(actions.isReadonly, () => menuText(t('NoEditAccess'))),
dom.maybe(actions.isReadonly, () => menuText(t("You do not have edit access to this document"))),
];
let pageElem: HTMLElement;

View File

@@ -17,7 +17,7 @@ import debounce = require('lodash/debounce');
export * from 'app/client/models/SearchModel';
const t = makeT('ui2018.search');
const t = makeT('search');
const EXPAND_TIME = .5;
@@ -146,7 +146,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
model.isOpen.set(_value === undefined ? !model.isOpen.get() : _value);
}, 100);
const inputElem: HTMLInputElement = searchInput(model.value, {onInput: true},
{type: 'text', placeholder: t('SearchInDocument')},
{type: 'text', placeholder: t("Search in document")},
dom.on('blur', () => (
keepExpanded ?
setTimeout(() => inputElem.focus(), 0) :
@@ -187,7 +187,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
const noMatch = use(model.noMatch);
const isEmpty = use(model.isEmpty);
if (isEmpty) { return null; }
if (noMatch) { return cssLabel(t("NoResults")); }
if (noMatch) { return cssLabel(t("No results")); }
return [
cssArrowBtn(
icon('Dropdown'),
@@ -197,7 +197,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
dom.on('click', () => model.findNext()),
hoverTooltip(
[
t('FindNext'),
t("Find Next "),
cssShortcut(`(${['Enter', allCommands.findNext.humanKeys].join(', ')})`),
],
{key: 'searchArrowBtnTooltip'}
@@ -211,7 +211,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
dom.on('click', () => model.findPrev()),
hoverTooltip(
[
t('FindPrevious'),
t("Find Previous "),
cssShortcut(allCommands.findPrev.getKeysDesc()),
],
{key: 'searchArrowBtnTooltip'}