Skip to content

Commit

Permalink
Alphabetize and create more specific localize keys
Browse files Browse the repository at this point in the history
  • Loading branch information
katherinejensen00 committed Sep 6, 2024
1 parent bf47710 commit fc6c1f0
Show file tree
Hide file tree
Showing 32 changed files with 233 additions and 213 deletions.
132 changes: 66 additions & 66 deletions assets/localization/en.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
{
"%product_name%": "Platform.Bible",
"%bookSelector_chooseEllipsis%": "Choose...",
"%bookSelector_chooseBooks%": "Choose Books",
"%bookSelector_currentBook%": "Current Book",
"%bookSelector_selectBooks%": "Select Books",
"%bookSelector_selectOneOrMoreBooksToRunBasicChecksOn%": "Select one or more books to run basic checks on",
"%checks_Capitalization%": "Capitalization",
"%checks_chapterSlashVerseNumbers%": "Chapter/Verse Numbers",
"%checks_charactersParenthesesCombinations%": "Characters (Combinations)",
"%checks_checks%": "Checks",
"%checks_footnoteQuotes%": "Footnote Quotes",
"%checks_markers%": "Markers",
"%checks_noCurrentProject%": "No current project",
"%checks_numbers%": "Numbers",
"%checks_punctuationParenthesesSequences%": "Punctuation (Sequences)",
"%checks_quotations%": "Quotations",
"%checks_quotationTypes%": "Quotation types",
"%checks_references%": "References",
"%checks_repeatedWords%": "Repeated Words",
"%checks_runBasicChecks%": "Run Basic Checks",
"%checks_unmatchedPairsOfPunctuation%": "Unmatched Pairs of Punctuation",
"%bookSelector_dialogPrompt_selectOneOrMoreBooksToRunBasicChecksOn%": "Select one or more books to run basic checks on",
"%bookSelector_selectionMode_chooseBooks%": "Choose Books",
"%bookSelector_selectionMode_currentBook%": "Current Book",
"%bookSelector_submitButton_chooseEllipsis%": "Choose...",
"%bookSelector_title_selectBooks%": "Select Books",
"%checks_checkName_capitalization%": "Capitalization",
"%checks_checkName_chapterSlashVerseNumbers%": "Chapter/Verse Numbers",
"%checks_checkName_charactersParenthesesCombinations%": "Characters (Combinations)",
"%checks_checkName_checks%": "Checks",
"%checks_checkName_footnoteQuotes%": "Footnote Quotes",
"%checks_checkName_markers%": "Markers",
"%checks_checkName_numbers%": "Numbers",
"%checks_checkName_punctuationParenthesesSequences%": "Punctuation (Sequences)",
"%checks_checkName_quotations%": "Quotations",
"%checks_checkName_quotationTypes%": "Quotation types",
"%checks_checkName_references%": "References",
"%checks_checkName_repeatedWords%": "Repeated Words",
"%checks_checkName_unmatchedPairsOfPunctuation%": "Unmatched Pairs of Punctuation",
"%checks_defaultNoProject_noCurrentProject%": "No current project",
"%checks_title_runBasicChecks%": "Run Basic Checks",
"%downloadUpdateProjectTab_aria_downloadableProjects%": "downloadable projects",
"%downloadUpdateProjectTab_aria_downloadedProjects%": "downloaded projects",
"%downloadUpdateProjectTab_listItem_delete%": "Delete",
"%downloadUpdateProjectTab_subheader_downloadableProjects%": "Downloadable Projects",
"%downloadUpdateProjectTab_subheader_downloadedProjects%": "Downloaded Projects",
"%downloadUpdateProjectTab_title_downloadSlashUpdateProject%": "Download/Update Project",
"%general_button_submit%": "Submit",
"%general_cancel%": "Cancel",
"%general_insertNote%": "Insert Note",
"%general_loading%": "Loading",
"%general_run%": "Run",
"%insertNote%": "Insert Note",
"%mainMenu_aboutPlatformBible%": "About Platform.Bible",
"%mainMenu_downloadSlashInstallResources%": "Download/Install Resources",
"%mainMenu_downloadSlashUpdateProject%": "Download/Update Project",
"%mainMenu_exit%": "Exit",
"%mainMenu_help%": "Help",
"%mainMenu_layout%": "Layout",
"%mainMenu_openProject%": "Open Project",
"%mainMenu_project%": "Project",
"%mainMenu_settings%": "Settings",
"%mainMenu_visitSupportBible%": "Visit Support.Bible",
"%mainMenu_window%": "Window",
"%mainMenu_menuItemName_aboutPlatformBible%": "About Platform.Bible",
"%mainMenu_menuItemName_downloadSlashInstallResources%": "Download/Install Resources",
"%mainMenu_menuItemName_exit%": "Exit",
"%mainMenu_menuItemName_help%": "Help",
"%mainMenu_menuItemName_layout%": "Layout",
"%mainMenu_menuItemName_openProject%": "Open Project",
"%mainMenu_menuItemName_project%": "Project",
"%mainMenu_menuItemName_settings%": "Settings",
"%mainMenu_menuItemName_visitSupportBible%": "Visit Support.Bible",
"%mainMenu_menuItemName_window%": "Window",
"%menuItemName_wordList%": "Word List",
"%product_name%": "Platform.Bible",
"%project_settings_platform_defaultFullName_nameMissing%": "*Name Missing*",
"%project_settings_platform_defaultLanguage_languageMissing%": "*Language Missing*",
"%project_settings_platform_defaultSettingName_noName%": "_NoName_",
"%project_settings_platform_group1_description%": "Project settings pertaining to the software overall",
"%project_settings_platform_settingName_fullName%": "Project Full Name",
"%project_settings_platform_settingName_group1%": "Platform Settings",
"%project_settings_platform_settingName_isEditable%": "Is Editable",
"%project_settings_platform_isEditable_description%": "Whether this project is editable. A project that is not editable is sometimes called a resource.",
"%project_settings_platform_settingName_language%": "Project Primary Language",
"%project_settings_platform_settingName_name%": "Project Short Name",
"%selectBooks_title_selectBooks%": "Select Books",
"%selectMultipleProjects_title_selectProjects%": "Select Projects",
"%selectProject_title_selectProject%": "Select Project",
"%settings_defaultMessage_loadingSetting%": "Loading setting",
"%settings_defaultSearchText_searchProjectSettingsEllipsis%": "Search Project Settings...",
"%settings_defaultSearchText_searchUserSettingsEllipsis%": "Search User Settings...",
"%settings_platform_group1_description%": "Settings pertaining to the software overall",
"%settings_platform_settingName_group1%": "Platform Settings",
"%settings_platform_settingName_interfaceLanguage%": "Interface Language",
"%settings_platform_settingName_paratextDataLastRegistryDataCachedTimes%": "ParatextData Last Registry Data Cached Times",
"%settings_platform_settingName_ptxUtilsMementoData%": "PtxUtils Memento Data",
"%settings_platform_settingName_verseRef%": "Current Verse Reference",
"%settings_title_projectSettings%": "Project Settings",
"%settings_title_userSettings%": "User Settings",
"%some_localization_key%": "This is the English text for %some_localization_key%.",
"%submitButton%": "Submit",
"%tab_error%": "Error",
"%tab_unknown%": "Unknown",
"%tabAria_tab%": "Tab",
"%webView_edit%": "Edit",
"%webView_openProjectSettings%": "Open Project Settings",
"%webView_project%": "Project",
"%webView_projectAssignmentsAndProgress%": "Assignments and Progress",
"%tab_aria_tab%": "Tab",
"%tab_title_error%": "Error",
"%tab_title_unknown%": "Unknown",
"%webView_defaultTitle_webView%": "Web View",
"%wordList%": "Word List",
"%selectBooks_selectBooks%": "Select Books",
"%selectProject_selectProject%": "Select Project",
"%selectMultipleProjects_selectProjects%": "Select Projects",
"%settings_loadingSetting%": "Loading setting",
"%settings_platform_group1_label%": "Platform Settings",
"%settings_searchProjectSettingsEllipsis%": "Search Project Settings...",
"%settings_searchUserSettingsEllipsis%": "Search User Settings...",
"%settings_platform_group1_description%": "Settings pertaining to the software overall",
"%settings_platform_verseRef_label%": "Current Verse Reference",
"%settings_platform_interfaceLanguage_label%": "Interface Language",
"%settings_platform_ptxUtilsMementoData_label%": "PtxUtils Memento Data",
"%settings_platform_paratextDataLastRegistryDataCachedTimes_label%": "ParatextData Last Registry Data Cached Times",
"%settings_projectSettings%": "Project Settings",
"%settings_userSettings%": "User Settings",
"%project_settings_platform_group1_label%": "Platform Settings",
"%project_settings_platform_group1_description%": "Project settings pertaining to the software overall",
"%project_settings_platform_name_label%": "Project Short Name",
"%project_name_missing%": "_NoName_",
"%project_settings_platform_fullName_label%": "Project Full Name",
"%project_full_name_missing%": "*Name Missing*",
"%project_language_missing%": "*Language Missing*",
"%project_settings_platform_language_label%": "Project Primary Language",
"%project_settings_platform_isEditable_label%": "Is Editable",
"%project_settings_platform_isEditable_description%": "Whether this project is editable. A project that is not editable is sometimes called a resource."
"%webView_menuItemName_edit%": "Edit",
"%webView_menuItemName_openProjectSettings%": "Open Project Settings",
"%webView_menuItemName_project%": "Project",
"%webView_menuItemName_projectAssignmentsAndProgress%": "Assignments and Progress",
"%webView_title_projectId_formatString%": "{projectId} {editable}"
}
2 changes: 1 addition & 1 deletion assets/localization/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"%some_localization_key%": "Ceci est le texte en français pour %some_localization_key%.",
"%submitButton%": "Soumettre",
"%general_button_submit%": "Soumettre",
"%Book.Gen%": "Genèse"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"metadata": {
"%helloWorld_webViewMenu_project%": {
"fallbackKey": "%mainMenu_project%"
"fallbackKey": "%mainMenu_menuItemName_project%"
},
"%mainMenu_openHelloWorldProject%": {
"fallbackKey": "%mainMenu_openProject%"
"fallbackKey": "%mainMenu_menuItemName_openProject%"
}
},
"localizedStrings": {
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/hello-world/contributions/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"command": "helloWorld.openViewerByWebViewId"
},
{
"label": "%webView_openProjectSettings%",
"label": "%webView_menuItemName_openProjectSettings%",
"group": "helloWorld.projectGroup",
"order": 3,
"command": "platform.openProjectSettings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ globalThis.webViewComponent = function HelloWorld({
const selectProjectsPrompt = '%selectProjects_prompt%';
const selectProjectsTitle = '%selectProjects_title%';
const selectProjectTitle = '%selectProject_title%';
const submit = '%submitButton%';
const submit = '%general_button_submit%';
const testException = '%helloWorld_throw_test_exception%';
const testMe = '%helloWorld_testMe%';

Expand Down
18 changes: 11 additions & 7 deletions extensions/src/platform-scripture-editor/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import type {
SavedWebViewDefinition,
WebViewDefinition,
} from '@papi/core';
import { LanguageStrings } from 'platform-bible-utils';
import { formatReplacementString, LanguageStrings } from 'platform-bible-utils';
import platformScriptureEditorWebView from './platform-scripture-editor.web-view?inline';
import platformScriptureEditorWebViewStyles from './platform-scripture-editor.web-view.scss?inline';

logger.info('Scripture Editor is importing!');

const scriptureEditorWebViewType = 'platformScriptureEditor.react';
const projectIdTitleFormatStr = '%webView_title_projectId_formatString%';
const editable = '%webView_platformScriptureEditor_editable%';
const resourceViewer = '%webView_platformScriptureEditor_resourceViewer%';
const scriptureEditor = '%webView_platformScriptureEditor_scriptureEditor%';
Expand All @@ -24,7 +25,7 @@ interface PlatformScriptureEditorOptions extends GetWebViewOptions {

async function getLocalizations(): Promise<LanguageStrings> {
const localizationData = await papi.localization.getLocalizedStrings({
localizeKeys: [editable, resourceViewer, scriptureEditor],
localizeKeys: [editable, projectIdTitleFormatStr, resourceViewer, scriptureEditor],
locales: ['en'],
});
return localizationData;
Expand Down Expand Up @@ -116,6 +117,7 @@ const scriptureEditorWebViewProvider: IWebViewProvider = {
);

const localizedStrings = await getLocalizations();
const localizedProjectIdTitleFormatStr = localizedStrings[projectIdTitleFormatStr];
const localizedEditable = localizedStrings[editable];
const localizedResourceViewer = localizedStrings[resourceViewer];
const localizedScriptureEditor = localizedStrings[scriptureEditor];
Expand All @@ -125,11 +127,13 @@ const scriptureEditorWebViewProvider: IWebViewProvider = {
const isReadOnly = getWebViewOptions.isReadOnly || savedWebView.state?.isReadOnly;
let title = '';
if (projectId) {
title = `${
(await (
await papi.projectDataProviders.get('platform.base', projectId)
).getSetting('platform.name')) ?? projectId
}${isReadOnly ? '' : ` ${localizedEditable}`}`;
title = formatReplacementString(localizedProjectIdTitleFormatStr, {
projectId:
(await (
await papi.projectDataProviders.get('platform.base', projectId)
).getSetting('platform.name')) ?? projectId,
editable: isReadOnly ? '' : localizedEditable,
});
} else title = isReadOnly ? localizedResourceViewer : localizedScriptureEditor;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('ContextMenu', () => {
const contextMenuTarget = screen.getByText('click me');
fireEvent.contextMenu(contextMenuTarget);

const insertNoteItem = screen.getByRole('menuitem', { name: '%insertNote%' });
const insertNoteItem = screen.getByRole('menuitem', { name: '%general_insertNote%' });

fireEvent.click(insertNoteItem);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('ContextMenu renders', () => {
it('the last group in a column without a final separator', () => {
const htmlForWordListItem = allMenuItems
.map((i) => i.outerHTML)
.find((html) => html && /%wordList%/.test(html));
.find((html) => html && /%menuItemName_wordList%/.test(html));

expect(htmlForWordListItem).toBeDefined();
expect(htmlForWordListItem).not.toMatch('hasDivider');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ describe('GridMenu renders', () => {
html: screen.getByRole('menu', { name: 'paratext.paratext' }),
label: '%mainMenu_Paratext%',
},
{ html: screen.getByRole('menu', { name: 'platform.window' }), label: '%mainMenu_Window%' },
{ html: screen.getByRole('menu', { name: 'platform.layout' }), label: '%mainMenu_Layout%' },
{ html: screen.getByRole('menu', { name: 'platform.help' }), label: '%mainMenu_Help%' },
{ html: screen.getByRole('menu', { name: 'platform.window' }), label: '%mainMenu_menuItemName_window%' },
{ html: screen.getByRole('menu', { name: 'platform.layout' }), label: '%mainMenu_menuItemName_layout%' },
{ html: screen.getByRole('menu', { name: 'platform.help' }), label: '%mainMenu_menuItemName_help%' },
];

expectedColumns.forEach((column) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"mainMenu": {
"columns": {
"paratext.paratext": { "label": "%mainMenu_Paratext%", "order": 0 },
"platform.window": { "label": "%mainMenu_Window%", "order": 1 },
"platform.layout": { "label": "%mainMenu_Layout%", "order": 2 },
"platform.help": { "label": "%mainMenu_Help%", "order": 3, "isExtensible": true },
"platform.window": { "label": "%mainMenu_menuItemName_window%", "order": 1 },
"platform.layout": { "label": "%mainMenu_menuItemName_layout%", "order": 2 },
"platform.help": { "label": "%mainMenu_menuItemName_help%", "order": 3, "isExtensible": true },
"isExtensible": true
},
"groups": {
Expand Down Expand Up @@ -92,8 +92,8 @@
},
"defaultWebViewTopMenu": {
"columns": {
"platform.project": { "label": "%webView_Project%", "order": 1 },
"platform.edit": { "label": "%webView_Edit%", "order": 2, "isExtensible": true }
"platform.project": { "label": "%webView_menuItemName_project%", "order": 1 },
"platform.edit": { "label": "%webView_menuItemName_edit%", "order": 2, "isExtensible": true }
},
"groups": {
"platform.projectTop": { "column": "platform.project", "order": 1 },
Expand Down Expand Up @@ -127,14 +127,14 @@
},
"items": [
{
"label": "%insertNote%",
"label": "%general_insertNote%",
"localizeNotes": "Web view context menu > Insert note...",
"group": "platform.insert",
"order": 1,
"command": "platform.insertNote"
},
{
"label": "%wordList%",
"label": "%menuItemName_wordList%",
"localizeNotes": "Web view context menu > Word list...",
"group": "platform.wordList",
"order": 1,
Expand Down
16 changes: 8 additions & 8 deletions src/extension-host/data/core-project-settings-info.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import { ProjectSettingsContribution } from 'platform-bible-utils';

/** Info about all project settings built into core. Does not contain info for extensions' settings */
export const platformProjectSettings: ProjectSettingsContribution = {
label: '%project_settings_platform_group1_label%',
label: '%project_settings_platform_settingName_group1%',
description: '%project_settings_platform_group1_description%',
properties: {
'platform.name': {
label: '%project_settings_platform_name_label%',
default: '%project_name_missing%',
label: '%project_settings_platform_settingName_name%',
default: '%project_settings_platform_defaultSettingName_noName%',
},
'platform.fullName': {
label: '%project_settings_platform_fullName_label%',
default: '%project_full_name_missing%',
label: '%project_settings_platform_settingName_fullName%',
default: '%project_settings_platform_defaultFullName_nameMissing%',
},
'platform.language': {
label: '%project_settings_platform_language_label%',
default: '%project_language_missing%',
label: '%project_settings_platform_settingName_language%',
default: '%project_settings_platform_defaultLanguage_languageMissing%',
},
'platform.isEditable': {
label: '%project_settings_platform_isEditable_label%',
label: '%project_settings_platform_settingName_isEditable%',
description: '%project_settings_platform_isEditable_description%',
default: true,
},
Expand Down
10 changes: 5 additions & 5 deletions src/extension-host/data/core-settings-info.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { isString, ScriptureReference, SettingsContribution } from 'platform-bib

/** Contribution of all settings built into core. Does not contain info for extensions' settings */
export const platformSettings: SettingsContribution = {
label: '%settings_platform_group1_label%',
label: '%settings_platform_settingName_group1%',
description: '%settings_platform_group1_description%',
properties: {
'platform.verseRef': {
label: '%settings_platform_verseRef_label%',
label: '%settings_platform_settingName_verseRef%',
default: { bookNum: 1, chapterNum: 1, verseNum: 1 },
},
'platform.interfaceLanguage': {
label: '%settings_platform_interfaceLanguage_label%',
label: '%settings_platform_settingName_interfaceLanguage%',
default: ['eng'],
},
'platform.ptxUtilsMementoData': {
label: '%settings_platform_ptxUtilsMementoData_label%',
label: '%settings_platform_settingName_ptxUtilsMementoData%',
default: {},
},
'platform.paratextDataLastRegistryDataCachedTimes': {
label: '%settings_platform_paratextDataLastRegistryDataCachedTimes_label%',
label: '%settings_platform_settingName_paratextDataLastRegistryDataCachedTimes%',
default: {},
},
},
Expand Down
Loading

0 comments on commit fc6c1f0

Please sign in to comment.