Skip to content

Commit

Permalink
fix: isolate code list editor text keys (#14051)
Browse files Browse the repository at this point in the history
  • Loading branch information
standeren authored Nov 19, 2024
1 parent 5b21dae commit 1860f7d
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 67 deletions.
1 change: 0 additions & 1 deletion frontend/language/src/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,6 @@
"ux_editor.no_text": "No text",
"ux_editor.radios_description_add": "Add descrption",
"ux_editor.radios_description_placeholder": "No description",
"ux_editor.radios_error_DuplicateValues": "All values must be unique.",
"ux_editor.radios_error_NoOptions": "There must be at least one radio button.",
"ux_editor.radios_legend_add": "Add title",
"ux_editor.radios_legend_placeholder": "Title is missing",
Expand Down
49 changes: 20 additions & 29 deletions frontend/language/src/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@
"app_release.release_title": "Appen bygges basert på",
"app_release.release_title_link": "siste endringstransaksjon til master",
"app_release.release_version": "Versjon:",
"code_list_editor.add_option": "Legg til alternativ",
"code_list_editor.column_title_delete": "Slett",
"code_list_editor.column_title_description": "Beskrivelse",
"code_list_editor.column_title_help_text": "Hjelpetekst",
"code_list_editor.column_title_label": "Ledetekst",
"code_list_editor.column_title_value": "Verdi",
"code_list_editor.delete_code_list_item": "Slett alternativ {{number}}",
"code_list_editor.description_item": "Beskrivelse for alternativ {{number}}",
"code_list_editor.duplicate_values_error": "Alle verdier må være unike.",
"code_list_editor.empty": "Kodelisten er tom.",
"code_list_editor.general_error": "Kan ikke lagre kodelisten, den inneholder feil.",
"code_list_editor.help_text_item": "Hjelpetekst for alternativ {{number}}",
"code_list_editor.label_item": "Ledetekst for alternativ {{number}}",
"code_list_editor.legend": "Kodeliste",
"code_list_editor.value_item": "Verdi for alternativ {{number}}",
"contact.email.content": "Du kan skrive en e-post til Altinn servicedesk hvis du har spørsmål om å opprette organisasjoner eller miljøer, opplever tekniske problemer eller har spørsmål om dokumentasjonen eller andre ting.",
"contact.email.heading": "Send e-post",
"contact.github_issue.content": "Hvis du har behov for funksjonalitet eller ser feil og mangler i Studio som vi må fikse, kan du opprette en sak i Github, så ser vi på den.",
Expand Down Expand Up @@ -1475,7 +1490,7 @@
"ux_editor.longitude_label": "Longitude",
"ux_editor.map_layer": "Kartlag",
"ux_editor.mobilePreview": "Mobilvisning",
"ux_editor.modal_add_options_codelist": "Kodeliste",
"ux_editor.modal_add_options_code_list": "Kodeliste",
"ux_editor.modal_add_options_manual": "Manuelt",
"ux_editor.modal_check_box_add_label": "Legg til tekst",
"ux_editor.modal_check_box_increment": "Avmerkingsboks",
Expand Down Expand Up @@ -1509,17 +1524,9 @@
"ux_editor.modal_new_option": "Legg til alternativ",
"ux_editor.modal_properties_add_radio_button_options": "Hvordan vil du legge til radioknapper?",
"ux_editor.modal_properties_code_list_custom_list": "Egendefinert kodeliste",
"ux_editor.modal_properties_code_list_delete_item": "Slett alternativ {{number}}",
"ux_editor.modal_properties_code_list_empty": "Kodelisten er tom.",
"ux_editor.modal_properties_code_list_filename_error": "Filnavnet er ugyldig. Du kan bruke tall, understrek, punktum, bindestrek, og store/små bokstaver fra det norske alfabetet. Filnavnet må starte med en engelsk bokstav.",
"ux_editor.modal_properties_code_list_general_error": "Kan ikke lagre kodelisten, den inneholder feil.",
"ux_editor.modal_properties_code_list_helper": "Velg kodeliste",
"ux_editor.modal_properties_code_list_id": "Kodeliste-ID",
"ux_editor.modal_properties_code_list_item_description": "Beskrivelse for alternativ {{number}}",
"ux_editor.modal_properties_code_list_item_helpText": "Hjelpetekst for alternativ {{number}}",
"ux_editor.modal_properties_code_list_item_help_text": "Hjelpetekst for alternativ {{number}}",
"ux_editor.modal_properties_code_list_item_label": "Ledetekst for alternativ {{number}}",
"ux_editor.modal_properties_code_list_item_value": "Verdi for alternativ {{number}}",
"ux_editor.modal_properties_code_list_open_editor": "Åpne redigeringsverktøy",
"ux_editor.modal_properties_code_list_read_more": "<0 href=\"{{optionsDocs}}\" >Les mer om kodelister</0>",
"ux_editor.modal_properties_code_list_read_more_dynamic": "<0 href=\"{{optionsDocs}}\" >Les mer om dynamiske kodelister</0>",
Expand Down Expand Up @@ -1668,26 +1675,13 @@
"ux_editor.no_components_selected": "Velg en side for å se forhåndsvisningen",
"ux_editor.no_text": "Ingen tekst",
"ux_editor.open_preview": "Åpne forhåndsvisning",
"ux_editor.options.codelist_create_info.heading": "Steg for å skrive inn kodelister manuelt",
"ux_editor.options.codelist_create_info.step1": "Gå til Gitea for å lage ny kodeliste.",
"ux_editor.options.codelist_create_info.step2": "Klikk på \"Add file\", deretter \"Ny fil\" for å åpne fileditoren.",
"ux_editor.options.codelist_create_info.step3": "Filen må ligge i mappen \"App/options\". Sørg for at den blir plassert der ved å oppgi denne stien i opplastingsfeltet. Når du skriver \"App/options/\", blir feltet automatisk oppdatert med mappesti.",
"ux_editor.options.codelist_create_info.step4": "Skriv inn kodelisten i tekstfeltet midt på siden. Kodelisten må være i JSON-format.",
"ux_editor.options.codelist_create_info.step5": "Velg \"Commit endringer\".",
"ux_editor.options.codelist_create_info.step6": "Du er nå ferdig i Gitea for denne gang. Gå tilbake til Altinn Studio-fanen, eller klikk på Altinn-logoen øverst til venstre i Gitea for å komme tilbake til Altinn Studio.",
"ux_editor.options.codelist_only": "Denne komponenten støtter bare oppsett med forhåndsdefinerte kodelister.",
"ux_editor.options.codelist_referenceId.description": "Her kan du legge til en referanse-ID til en dynamisk kodeliste som er satt opp i koden.",
"ux_editor.options.codelist_referenceId.description_details": "Du bruker dynamiske kodelister for å tilpasse alternativer for brukerne. Det kan for eksempel være tilpasninger ut fra geografisk plassering, eller valg brukeren gjør tidligere i skjemaet.",
"ux_editor.options.codelist_upload_info.heading": "Steg for å laste opp kodelister manuelt",
"ux_editor.options.codelist_upload_info.step1": "Gå til Gitea for å laste opp kodeliste.",
"ux_editor.options.codelist_upload_info.step2": "Klikk på \"Add file\", deretter \"Last opp fil\" og last opp kodelisten.",
"ux_editor.options.codelist_upload_info.step3": "Filen må ligge i mappen \"App/options\". Sørg for at den blir plassert der ved å oppgi denne stien i opplastingsfeltet. Når du skriver \"App/options/\", blir feltet automatisk oppdatert med mappesti.",
"ux_editor.options.codelist_upload_info.step4": "Velg \"Commit endringer\".",
"ux_editor.options.codelist_upload_info.step5": "Du er nå ferdig i Gitea for denne gang. Gå tilbake til Altinn Studio-fanen, eller klikk på Altinn-logoen øverst til venstre i Gitea for å komme tilbake til Altinn Studio.",
"ux_editor.options.code_list_only": "Denne komponenten støtter bare oppsett med forhåndsdefinerte kodelister.",
"ux_editor.options.code_list_referenceId.description": "Her kan du legge til en referanse-ID til en dynamisk kodeliste som er satt opp i koden.",
"ux_editor.options.code_list_referenceId.description_details": "Du bruker dynamiske kodelister for å tilpasse alternativer for brukerne. Det kan for eksempel være tilpasninger ut fra geografisk plassering, eller valg brukeren gjør tidligere i skjemaet.",
"ux_editor.options.multiple": "{{value}} alternativer",
"ux_editor.options.section_heading": "Valg for kodelister",
"ux_editor.options.single": "{{value}} alternativ",
"ux_editor.options.tab_codelist": "Velg kodeliste",
"ux_editor.options.tab_code_list": "Velg kodeliste",
"ux_editor.options.tab_manual": "Sett opp egne alternativer",
"ux_editor.options.tab_referenceId": "Angi referanse-ID",
"ux_editor.page": "Side",
Expand Down Expand Up @@ -1736,8 +1730,6 @@
"ux_editor.properties_panel.images.upload_image_file_size_limit": "Største tillate filstørrelse er {{maxSize}} MB",
"ux_editor.properties_panel.images.validating_image_url_error": "Kunne ikke validere bildeadressen.",
"ux_editor.properties_panel.images.validating_image_url_pending": "Validerer bildeadressen …",
"ux_editor.properties_panel.options.codelist_switch_to_custom": "Bytt til egendefinert kodeliste",
"ux_editor.properties_panel.options.codelist_switch_to_static": "Bytt til statisk kodeliste",
"ux_editor.properties_panel.options.use_code_list_label": "Bruk kodeliste",
"ux_editor.properties_panel.subform_table_columns.add_column": "Legg til kolonne",
"ux_editor.properties_panel.subform_table_columns.cell_content_default_label": "Default",
Expand All @@ -1753,7 +1745,6 @@
"ux_editor.properties_panel.texts.no_properties": "Det er ingen tekster å konfigurere for denne komponenten.",
"ux_editor.properties_panel.texts.sub_title_images": "Valg for bilde",
"ux_editor.properties_panel.texts.sub_title_texts": "Tekster",
"ux_editor.radios_error_DuplicateValues": "Alle verdier må være unike.",
"ux_editor.radios_error_NoOptions": "Det må være minst én radioknapp.",
"ux_editor.radios_option": "Radioknapp {{optionNumber}}",
"ux_editor.search_text_resources_close": "Lukk tekstsøk",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('EditOptions', () => {

it('should show code list input by default when neither options nor optionId are set', async () => {
await render();
expect(screen.getByText(textMock('ux_editor.modal_add_options_codelist'))).toBeInTheDocument();
expect(screen.getByText(textMock('ux_editor.modal_add_options_code_list'))).toBeInTheDocument();
});

it('should show manual input when component has options defined', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function EditOptions({
size='small'
>
<Radio value={SelectedOptionsType.CodeList}>
{t('ux_editor.modal_add_options_codelist')}
{t('ux_editor.modal_add_options_code_list')}
</Radio>
<Radio value={SelectedOptionsType.Manual}>{t('ux_editor.modal_add_options_manual')}</Radio>
</Radio.Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('EditOptions', () => {
});
expect(
await screen.findByRole('tab', {
name: textMock('ux_editor.options.tab_codelist'),
name: textMock('ux_editor.options.tab_code_list'),
selected: true,
}),
).toBeInTheDocument();
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('EditOptions', () => {

expect(
await screen.findByRole('tab', {
name: textMock('ux_editor.options.tab_codelist'),
name: textMock('ux_editor.options.tab_code_list'),
selected: true,
}),
).toBeInTheDocument();
Expand Down Expand Up @@ -160,18 +160,18 @@ describe('EditOptions', () => {

expect(
screen.queryByRole('tab', {
name: textMock('ux_editor.options.tab_codelist'),
name: textMock('ux_editor.options.tab_code_list'),
selected: true,
}),
).not.toBeInTheDocument();

const codelistTabElement = await screen.findByRole('tab', {
name: textMock('ux_editor.options.tab_codelist'),
name: textMock('ux_editor.options.tab_code_list'),
});
await waitFor(() => user.click(codelistTabElement));
expect(
screen.getByRole('tab', {
name: textMock('ux_editor.options.tab_codelist'),
name: textMock('ux_editor.options.tab_code_list'),
selected: true,
}),
).toBeInTheDocument();
Expand Down Expand Up @@ -217,7 +217,7 @@ describe('EditOptions', () => {
});

await waitFor(() => user.click(manualTabElement));
expect(screen.getByText(textMock('ux_editor.options.codelist_only'))).toBeInTheDocument();
expect(screen.getByText(textMock('ux_editor.options.code_list_only'))).toBeInTheDocument();
});

it('should show error message if query fails', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('EditManualOptionsWithEditor', () => {
await user.click(modalButton);

const addNewButton = screen.getByRole('button', {
name: textMock('ux_editor.modal_new_option'),
name: textMock('code_list_editor.add_option'),
});

await user.click(addNewButton);
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('EditManualOptionsWithEditor', () => {
await user.click(modalButton);

const addNewButton = screen.getByRole('button', {
name: textMock('ux_editor.modal_new_option'),
name: textMock('code_list_editor.add_option'),
});

await user.click(addNewButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function EditManualOptionsWithEditor({
className={classes.manualTabDialog}
contentClassName={classes.content}
closeButtonTitle={t('general.close')}
heading={t('ux_editor.modal_add_options_codelist')}
heading={t('ux_editor.modal_add_options_code_list')}
>
<StudioCodeListEditor
codeList={component.options ?? []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('EditOptionListReference', () => {
it('should render', () => {
renderEditOptionListReference();
expect(
screen.getByText(textMock('ux_editor.options.codelist_referenceId.description')),
screen.getByText(textMock('ux_editor.options.code_list_referenceId.description')),
).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export function EditOptionListReference<T extends SelectionComponentType>({
return (
<div>
<StudioParagraph spacing size='small'>
{t('ux_editor.options.codelist_referenceId.description')}
{t('ux_editor.options.code_list_referenceId.description')}
</StudioParagraph>
<StudioParagraph spacing size='small'>
{t('ux_editor.options.codelist_referenceId.description_details')}
{t('ux_editor.options.code_list_referenceId.description_details')}
</StudioParagraph>
<StudioTextfield
type='text'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('OptionListEditor', () => {

await openModal(user);
const textBox = screen.getByRole('textbox', {
name: textMock('ux_editor.modal_properties_code_list_item_description', { number: 2 }),
name: textMock('code_list_editor.description_item', { number: 2 }),
});
await user.type(textBox, 'test');

Expand All @@ -106,7 +106,7 @@ describe('OptionListEditor', () => {

await openModal(user);
const textBox = screen.getByRole('textbox', {
name: textMock('ux_editor.modal_properties_code_list_item_description', { number: 2 }),
name: textMock('code_list_editor.description_item', { number: 2 }),
});
await user.type(textBox, 'test');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function OptionListEditorModal({
className={classes.editOptionTabModal}
contentClassName={classes.content}
closeButtonTitle={t('general.close')}
heading={t('ux_editor.modal_add_options_codelist')}
heading={t('ux_editor.modal_add_options_code_list')}
onBeforeClose={handleClose}
onInteractOutside={handleClose}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const OptionTabs = ({
>
<StudioTabs.List>
<StudioTabs.Tab value={SelectedOptionsType.CodeList}>
{t('ux_editor.options.tab_codelist')}
{t('ux_editor.options.tab_code_list')}
</StudioTabs.Tab>
<StudioTabs.Tab value={SelectedOptionsType.Manual}>
{t('ux_editor.options.tab_manual')}
Expand Down Expand Up @@ -102,7 +102,7 @@ const RenderManualOptions = ({
if (areLayoutOptionsSupported === false) {
return (
<StudioAlert className={classes.manualTabAlert} severity='info'>
{t('ux_editor.options.codelist_only')}
{t('ux_editor.options.code_list_only')}
</StudioAlert>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,22 @@ export const useOptionListEditorTexts = (): CodeListEditorTexts => {
const { t } = useTranslation();

return {
add: t('ux_editor.modal_new_option'),
codeList: t('ux_editor.modal_add_options_codelist'),
delete: t('general.delete'),
deleteItem: (number: number) =>
t('ux_editor.modal_properties_code_list_delete_item', { number }),
description: t('general.description'),
emptyCodeList: t('ux_editor.modal_properties_code_list_empty'),
add: t('code_list_editor.add_option'),
delete: t('code_list_editor.column_title_delete'),
value: t('code_list_editor.column_title_value'),
label: t('code_list_editor.column_title_label'),
description: t('code_list_editor.column_title_description'),
helpText: t('code_list_editor.column_title_help_text'),
deleteItem: (number: number) => t('code_list_editor.delete_code_list_item', { number }),
itemValue: (number: number) => t('code_list_editor.value_item', { number }),
itemLabel: (number: number) => t('code_list_editor.label_item', { number }),
itemDescription: (number: number) => t('code_list_editor.description_item', { number }),
itemHelpText: (number: number) => t('code_list_editor.help_text_item', { number }),
codeList: t('code_list_editor.legend'),
emptyCodeList: t('code_list_editor.empty'),
valueErrors: {
duplicateValue: t('ux_editor.radios_error_DuplicateValues'),
duplicateValue: t('code_list_editor.duplicate_values_error'),
},
generalError: t('ux_editor.modal_properties_code_list_general_error'),
helpText: t('ux_editor.modal_properties_textResourceBindings_help'),
itemDescription: (number: number) =>
t('ux_editor.modal_properties_code_list_item_description', { number }),
itemHelpText: (number: number) =>
t('ux_editor.modal_properties_code_list_item_helpText', { number }),
itemLabel: (number: number) => t('ux_editor.modal_properties_code_list_item_label', { number }),
itemValue: (number: number) => t('ux_editor.modal_properties_code_list_item_value', { number }),
label: t('ux_editor.modal_properties_textResourceBindings_title'),
value: t('general.value'),
generalError: t('code_list_editor.general_error'),
};
};

0 comments on commit 1860f7d

Please sign in to comment.