fix: add .ts extensions to i18n imports for ESM compatibility

This commit is contained in:
Jadilson Guedes
2026-02-16 16:38:29 -03:00
committed by Peter Steinberger
parent e0c45eab49
commit f20bef3d79
10 changed files with 20 additions and 20 deletions

View File

@@ -1,3 +1,3 @@
export * from "./lib/types";
export * from "./lib/translate";
export * from "./lib/lit-controller";
export * from "./lib/types.ts";
export * from "./lib/translate.ts";
export * from "./lib/lit-controller.ts";

View File

@@ -1,5 +1,5 @@
import type { ReactiveController, ReactiveControllerHost } from "lit";
import { i18n } from "./translate";
import { i18n } from "./translate.ts";
export class I18nController implements ReactiveController {
private host: ReactiveControllerHost;

View File

@@ -1,5 +1,5 @@
import type { Locale, TranslationMap } from "./types";
import { en } from "../locales/en";
import type { Locale, TranslationMap } from "./types.ts";
import { en } from "../locales/en.ts";
type Subscriber = (locale: Locale) => void;
@@ -40,11 +40,11 @@ class I18nManager {
try {
let module;
if (locale === "zh-CN") {
module = await import("../locales/zh-CN");
module = await import("../locales/zh-CN.ts");
} else if (locale === "zh-TW") {
module = await import("../locales/zh-TW");
module = await import("../locales/zh-TW.ts");
} else if (locale === "pt-BR") {
module = await import("../locales/pt-BR");
module = await import("../locales/pt-BR.ts");
} else {
return;
}

View File

@@ -1,4 +1,4 @@
import type { TranslationMap } from "../lib/types";
import type { TranslationMap } from "../lib/types.ts";
export const en: TranslationMap = {
common: {

View File

@@ -1,4 +1,4 @@
import type { TranslationMap } from "../lib/types";
import type { TranslationMap } from "../lib/types.ts";
export const pt_BR: TranslationMap = {
common: {

View File

@@ -1,4 +1,4 @@
import type { TranslationMap } from "../lib/types";
import type { TranslationMap } from "../lib/types.ts";
export const zh_CN: TranslationMap = {
common: {

View File

@@ -1,4 +1,4 @@
import type { TranslationMap } from "../lib/types";
import type { TranslationMap } from "../lib/types.ts";
export const zh_TW: TranslationMap = {
common: {

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, vi } from "vitest";
import { i18n, t } from "../lib/translate";
import { i18n, t } from "../lib/translate.ts";
describe("i18n", () => {
beforeEach(() => {

View File

@@ -1,5 +1,5 @@
import type { IconName } from "./icons.js";
import { t } from "../i18n/index.js";
import { t } from "../i18n/index.ts";
export const TAB_GROUPS = [
{ label: "chat", tabs: ["chat"] },

View File

@@ -1,9 +1,9 @@
import { html } from "lit";
import type { GatewayHelloOk } from "../gateway";
import type { UiSettings } from "../storage";
import { t, i18n, type Locale } from "../../i18n";
import { formatAgo, formatDurationMs } from "../format";
import { formatNextRun } from "../presenter";
import type { GatewayHelloOk } from "../gateway.ts";
import type { UiSettings } from "../storage.ts";
import { t, i18n, type Locale } from "../../i18n/index.ts";
import { formatAgo, formatDurationMs } from "../format.ts";
import { formatNextRun } from "../presenter.ts";
export type OverviewProps = {
connected: boolean;