Skip to content

Commit

Permalink
chore: use getLocaleID for l10nID
Browse files Browse the repository at this point in the history
  • Loading branch information
windingwind committed Jun 23, 2024
1 parent 489e594 commit aae258d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/modules/tabpanel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getString } from "../utils/locale";
import { getLocaleID, getString } from "../utils/locale";
import { config } from "../../package.json";
import { LANG_CODE, SERVICES } from "../utils/config";
import { getPref, setPref } from "../utils/prefs";
Expand All @@ -16,11 +16,11 @@ export function registerReaderTabPanel() {
paneID: "translate",
pluginID: config.addonID,
header: {
l10nID: `${config.addonRef}-itemPaneSection-header`,
l10nID: getLocaleID("itemPaneSection-header"),
icon: `chrome://${config.addonRef}/content/icons/section-16.svg`,
},
sidenav: {
l10nID: `${config.addonRef}-itemPaneSection-sidenav`,
l10nID: getLocaleID("itemPaneSection-sidenav"),
icon: `chrome://${config.addonRef}/content/icons/section-20.svg`,
},
onInit,
Expand All @@ -31,7 +31,7 @@ export function registerReaderTabPanel() {
{
type: "fullHeight",
icon: `chrome://${config.addonRef}/content/icons/full-16.svg`,
l10nID: `${config.addonRef}-itemPaneSection-fullHeight`,
l10nID: getLocaleID("itemPaneSection-fullHeight"),
onClick: ({ body }: { body: HTMLElement }) => {
const details = body.closest("item-details");
onUpdateHeight({ body });
Expand Down
6 changes: 5 additions & 1 deletion src/utils/locale.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config } from "../../package.json";

export { initLocale, getString };
export { initLocale, getString, getLocaleID };

/**
* Initialize locale data
Expand Down Expand Up @@ -85,3 +85,7 @@ function _getString(
return pattern.value || localStringWithPrefix;
}
}

function getLocaleID(id: string) {
return `${config.addonRef}-${id}`;
}

0 comments on commit aae258d

Please sign in to comment.