Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/crates/rid-app/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"windows": {
"nsis": {
"installMode": "perMachine",
"languages": ["SimpChinese", "English"]
"languages": ["SimpChinese", "English", "PortugueseBR"]
}
}
},
Expand Down
7 changes: 4 additions & 3 deletions client/crates/rid-app/ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { actionItems, jump, report } from "./actions";
import AiDialog from "./AiDialog.vue";
import { type LaunchRequest, api, formatSize, targetText } from "./api";
import HistoryDialog from "./HistoryDialog.vue";
import { lang, t } from "./i18n";
import { lang, locales, t } from "./i18n";
import MenuList, { type MenuItem } from "./MenuList.vue";
import { prefs, resetColumns } from "./prefs";
import PrefsDialog from "./PrefsDialog.vue";
Expand Down Expand Up @@ -148,6 +148,7 @@ const menus = computed<{ label: string; items: MenuItem[] }[]>(() => [
{ label: t("view.langAuto"), checked: prefs.lang === "auto", run: () => (prefs.lang = "auto") },
{ label: "简体中文", checked: prefs.lang === "zh", run: () => (prefs.lang = "zh") },
{ label: "English", checked: prefs.lang === "en", run: () => (prefs.lang = "en") },
{ label: "Português (Brasil)", checked: prefs.lang === "pt", run: () => (prefs.lang = "pt") },
],
},
],
Expand Down Expand Up @@ -257,7 +258,7 @@ async function exportHtml() {
.join("\n");
const title = t("export.title", rows.value.length);
const html = `<!doctype html>
<html lang="${lang.value === "zh" ? "zh-CN" : "en"}"><head><meta charset="utf-8"><title>${esc(title)}</title>
<html lang="${locales[lang.value]}"><head><meta charset="utf-8"><title>${esc(title)}</title>
<style>body{font:14px "Segoe UI",sans-serif;margin:24px}table{border-collapse:collapse}th,td{padding:4px 12px;border:1px solid #ccc;text-align:left}</style>
</head><body><h1>${esc(title)}</h1>
<table>
Expand All @@ -276,7 +277,7 @@ systemDark.addEventListener("change", (e) => (dark.value = e.matches));
watchEffect(() => {
const root = document.documentElement;
root.dataset.theme = prefs.theme === "auto" ? (dark.value ? "dark" : "light") : prefs.theme;
root.lang = lang.value === "zh" ? "zh-CN" : "en";
root.lang = locales[lang.value];
localStorage.setItem("rid.theme", root.dataset.theme);
});

Expand Down
4 changes: 2 additions & 2 deletions client/crates/rid-app/ui/src/HistoryDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { onMounted, ref } from "vue";
import { report } from "./actions";
import { type BatchInfo, api, formatSize } from "./api";
import { lang, t } from "./i18n";
import { lang, locales, t } from "./i18n";
import { confirmBox, notify } from "./ui";

const emit = defineEmits<{ close: [changed: boolean] }>();
Expand All @@ -13,7 +13,7 @@ let changed = false;

const load = () => api.quarantineList().then((b) => (batches.value = b), report);

const when = (b: BatchInfo) => new Date(b.created * 1000).toLocaleString(lang.value === "zh" ? "zh-CN" : "en-US");
const when = (b: BatchInfo) => new Date(b.created * 1000).toLocaleString(locales[lang.value]);

async function act(work: () => Promise<void>) {
busy.value = true;
Expand Down
1 change: 1 addition & 0 deletions client/crates/rid-app/ui/src/PrefsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const languages = computed(() => [
{ value: "auto" as const, label: t("view.langAuto") },
{ value: "zh" as const, label: "简体中文" },
{ value: "en" as const, label: "English" },
{ value: "pt" as const, label: "Português (Brasil)" },
]);
const themes = computed(() => [
{ value: "auto" as const, label: t("prefs.schemeAuto") },
Expand Down
6 changes: 3 additions & 3 deletions client/crates/rid-app/ui/src/UninstallerView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { actionItems, askAbout, canUninstall, jump } from "./actions";
import { type App, type InstallerInfo, SOURCES, api, appIcon, formatSize } from "./api";
import { useColumns } from "./columns";
import { type MsgKey, lang, t } from "./i18n";
import { type MsgKey, lang, locales, t } from "./i18n";
import { type SortKey, prefs } from "./prefs";
import { type Row, category, current, filter, isRecent, loading, rows, selected, selection, setOpen, sizeOf, start } from "./store";
import TableHead from "./TableHead.vue";
Expand All @@ -18,7 +18,7 @@ defineExpose({ focusList: () => listEl.value?.focus() });
const cols = useColumns("uninstaller", () => [
{ key: "name", label: t("col.name"), width: 0, sortable: true },
{ key: "size", label: t("col.size"), width: 92, sortable: true, hidden: !prefs.columns.size },
{ key: "date", label: t("col.date"), width: 124, sortable: true, hidden: !prefs.columns.date },
{ key: "date", label: t("col.date"), width: 140, sortable: true, hidden: !prefs.columns.date },
{ key: "publisher", label: t("col.publisher"), width: 190, sortable: true, hidden: !prefs.columns.publisher },
{ key: "version", label: t("col.version"), width: 130, sortable: true, hidden: !prefs.columns.version },
{ key: "update", label: t("col.update"), width: 110, hidden: !prefs.columns.update },
Expand Down Expand Up @@ -57,7 +57,7 @@ function sortBy(key: string) {

function formatDate(day: string | null): string {
if (!day) return "";
return new Date(`${day}T00:00:00`).toLocaleDateString(lang.value === "zh" ? "zh-CN" : "en-US", {
return new Date(`${day}T00:00:00`).toLocaleDateString(locales[lang.value], {
year: "numeric",
month: "short",
day: "2-digit",
Expand Down
Loading