Skip to content

Commit

Permalink
feat: add i18n integration for html pages
Browse files Browse the repository at this point in the history
  • Loading branch information
zyf722 committed Apr 6, 2024
1 parent ae6561e commit e426d0f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/livecodes/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ import {
import { customEvents } from './events/custom-events';
import { populateConfig } from './import/utils';
import { permanentUrlService } from './services/permanent-url';
import i18n from './i18n';

// declare global dependencies
declare const window: Window & {
Expand Down Expand Up @@ -2995,6 +2996,13 @@ const handleWelcome = () => {
const welcomeContainer = div.firstChild as HTMLElement;
modal.show(welcomeContainer);

welcomeContainer.querySelectorAll('.i18n').forEach((elem) => {
elem.textContent = i18n.t(elem.innerHTML);

// eslint-disable-next-line no-console
console.log('i18n', elem.textContent);
});

const showWelcomeCheckbox = UI.getModalShowWelcomeCheckbox(welcomeContainer);
showWelcomeCheckbox.checked = getConfig().welcome;

Expand Down

0 comments on commit e426d0f

Please sign in to comment.