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
5 changes: 5 additions & 0 deletions apps/mint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ API `https://mint-api.juw12.workers.dev/api/health`
formulas follow the renamed tabs.
- **Links pick the language (3.5.1).** Add `?lang=en|id|zh|es` to any Mint link (Budget, the marketplace, the
legal pages) and it opens in that language without changing the reader's saved choice.
- **Templates in your language (3.5.2).** A prompt in Indonesian, Chinese or Spanish (`anggaran bulanan keluarga`,
`网店库存表,绿色`, `Inventario para mi tienda online`) now finds the right blueprint and fills it in that language:
title, column names, dropdowns, summary cards, highlight rules and sample rows. Columns are renamed through the
formula engine, so every formula, card and rule keeps working (checked for all 14 blueprints × 3 languages). When
the prompt gives no clue (`budget`), the app language decides.
- **Studio understands Chinese and Spanish (3.5.1).** Tweak commands such as `添加供应商列`, `货币 人民币`,
`añade la columna Proveedor` or `resalta Qty menor que 5 en rojo` now work, as the zh/es screens already
suggested; colour and currency words in those languages also steer new templates (`网店库存表,绿色` → green).
Expand Down
2 changes: 1 addition & 1 deletion apps/mint/desktop/mint.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import os
import sys

DESKTOP = os.path.dirname(os.path.abspath(SPEC)) # noqa: F821 (provided by PyInstaller)
VERSION = os.environ.get("MINT_VERSION", "3.5.1")
VERSION = os.environ.get("MINT_VERSION", "3.5.2")
VERSION_FILE = os.environ.get("MINT_VERSION_FILE") or None
ICON = os.environ.get("MINT_ICON") or None
IS_WIN = sys.platform == "win32"
Expand Down
2 changes: 1 addition & 1 deletion apps/mint/desktop/mint_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import urllib.request
import webbrowser

VERSION = "3.5.1"
VERSION = "3.5.2"
TITLE = "Mint"
APP_URL = os.environ.get("MINT_DESKTOP_URL") or "https://juw12.github.io/projects/mint/"
DEFAULT_SIZE = (1280, 860)
Expand Down
2 changes: 1 addition & 1 deletion apps/mint/tests/test_budget_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_language_and_region_are_asked_first(self):
self.assertIn("data-act-change=\"set-region\"", budget_app, "Settings can change the region later")
self.assertIn("window.MintLocale.current()", budget_app, "new budgets use the chosen currency")
templates_app = read(MINT_WEB / "js" / "app.js")
self.assertIn("Core.generate(prompt, { currency: regionCurrency() })", templates_app)
self.assertIn("Core.generate(prompt, { currency: regionCurrency(), lang: uiLang() })", templates_app)
for worker, entry in ((WEB / "sw.js", "'../js/locale.js'"), (MINT_WEB / "sw.js", '"js/locale.js"')):
self.assertIn(entry, read(worker), "%s caches locale.js for offline use" % worker.name)

Expand Down
40 changes: 40 additions & 0 deletions apps/mint/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,36 @@ def seed_checks():
function lastCol(r) {
return r.spec.sheet.columns.slice(-1)[0];
}
var zhInv = C.generate("网店库存表,绿色").spec;
var esInv = C.generate("Inventario para mi tienda online, verde").spec;
var idBudget = C.generate("anggaran bulanan keluarga").spec;
var enInv = C.generate("inventory tracker for my toko in rupiah, ocean theme").spec;
var uiZh = C.generate("budget", {lang: "zh"}).spec;
var l10nBroken = [];
C.BLUEPRINTS.forEach(function (bp) {
var english = C.compute(C.specFromBlueprint(bp)).summary.map(function (s) { return s.value; });
["id", "zh", "es"].forEach(function (lang) {
var spec = C.normalize(C.localizeSpec(C.specFromBlueprint(bp), lang));
var comp = C.compute(spec);
var names = spec.sheet.columns.map(function (c) { return c.name; });
var orphan = spec.summary.concat(spec.rules).some(function (x) { return names.indexOf(x.column) === -1; });
var values = comp.summary.map(function (s) { return s.value; });
if (Object.keys(comp.errors).length || orphan || JSON.stringify(values) !== JSON.stringify(english)) {
l10nBroken.push(bp.id + "/" + lang);
}
});
});
out.templateL10n = {
zhInv: [zhInv.blueprint, zhInv.title, zhInv.sheet.columns.map(function (c) { return c.name; })],
esInv: [esInv.blueprint, esInv.sheet.columns[2].name],
idBudget: [idBudget.sheet.columns[0].name, idBudget.sheet.columns[0].options[0]],
enInv: enInv.sheet.columns.map(function (c) { return c.name; }),
uiZh: uiZh.title,
langs: [C.detectPromptLang("网店库存表"), C.detectPromptLang("Inventario para mi tienda"),
C.detectPromptLang("anggaran bulanan keluarga"), C.detectPromptLang("inventory tracker for my shop"),
C.detectPromptLang("budget")],
broken: l10nBroken
};
out.tweaksIntl = {
zhAdd: lastCol(tZhAdd).name,
zhOpts: [lastCol(tZhOpts).type, lastCol(tZhOpts).options],
Expand Down Expand Up @@ -308,6 +338,16 @@ def js_checks():
check(tweaks["currency"] == "EUR", "'currency EUR'")
check(tweaks["unknownChanged"] is False, "unknown command changes nothing")

tl = out["templateL10n"]
check(tl["zhInv"][0] == "inventory" and tl["zhInv"][1] == "库存与补货表" and "数量" in tl["zhInv"][2],
"zh prompt finds the inventory blueprint, in Chinese")
check(tl["esInv"] == ["inventory", "Cant."], "es prompt gives a Spanish inventory template")
check(tl["idBudget"] == ["Kategori", "Tempat Tinggal"], "id prompt gives Indonesian columns and options")
check(tl["enInv"][:3] == ["SKU", "Item", "Qty"], "English prompt with one Indonesian word stays English")
check(tl["uiZh"] == "每月预算表", "unclear prompt follows the app language")
check(tl["langs"] == ["zh", "es", "id", "en", None], "prompt language detection")
check(tl["broken"] == [], "every blueprint computes the same in id/zh/es " + str(tl["broken"]))

intl = out["tweaksIntl"]
check(intl["zhAdd"] == "供应商", "zh '添加供应商列' adds a column")
check(intl["zhOpts"] == ["select", ["待办", "完成"]], "zh options split on 、")
Expand Down
2 changes: 1 addition & 1 deletion apps/mint/web/budget/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(function (root) {
'use strict';
const K = (root.MintBudget = root.MintBudget || {});
K.VERSION = '3.5.1';
K.VERSION = '3.5.2';

/** Compare dotted versions numerically: 1, 0 or -1 ("1.10.0" is newer than "1.9.9"). */
K.compareVersions = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion apps/mint/web/budget/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Mint Budget service worker: network-first app shell so updates land immediately, cache as offline fallback.
* Scope is budget/ only; Mint Templates (../app.html) has its own worker at ../sw.js. */
const CACHE = 'mint-budget-v16';
const CACHE = 'mint-budget-v17';
// Caches this worker owns: its own generations, plus the ones versions before Mint 3.0 left behind.
// Never touch other caches: every app on this origin shares one CacheStorage.
const OWN_CACHE = /^(mint-budget-v|kitty-v)/;
Expand Down
6 changes: 5 additions & 1 deletion apps/mint/web/budget/version.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"version": "3.5.1",
"version": "3.5.2",
"released": "2026-11-09",
"notes": {
"en": [
"Templates come out in your language: a prompt in Indonesian, Chinese or Spanish gives column names, dropdowns, cards and sample rows in that language, with every formula still working.",
"Links can choose the language: add ?lang=es (or id, zh, en) and Budget, the marketplace and the legal pages open in it, without changing your saved choice.",
"Templates Studio understands Chinese and Spanish commands, like 添加供应商列 or añade la columna Proveedor.",
"Live prices in Invest: stocks and ETFs (IDX and US), crypto and gold update from the market. Tap Refresh prices any time; prices you type yourself stay until you refresh.",
Expand All @@ -12,6 +13,7 @@
"Desktop app: opens even without internet the very first time; budgets made offline move online on their own."
],
"id": [
"Template kini keluar dalam bahasamu: perintah dalam Bahasa Indonesia, Mandarin, atau Spanyol menghasilkan nama kolom, pilihan, kartu, dan contoh baris dalam bahasa itu, dengan semua rumus tetap berjalan.",
"Tautan bisa memilih bahasa: tambahkan ?lang=id (atau en, zh, es) dan Budget, marketplace, serta halaman legal terbuka dalam bahasa itu tanpa mengubah pilihan tersimpanmu.",
"Studio Template kini memahami perintah berbahasa Mandarin dan Spanyol, seperti 添加供应商列 atau añade la columna Proveedor.",
"Harga live di Investasi: saham dan ETF (BEI dan AS), kripto, dan emas mengikuti pasar. Ketuk Perbarui harga kapan saja; harga yang kamu isi sendiri tetap sampai kamu memperbarui.",
Expand All @@ -21,6 +23,7 @@
"Aplikasi desktop: tetap terbuka tanpa internet sejak pertama kali; anggaran yang dibuat offline pindah ke online dengan sendirinya."
],
"zh": [
"模板现在用你的语言生成:用中文、印尼语或西班牙语描述,列名、下拉选项、汇总卡片和示例行都会是该语言,所有公式照常运行。",
"链接可以指定语言:加上 ?lang=zh(或 en、id、es),预算、市场和法律页面就会以该语言打开,不会改变你保存的设置。",
"模板工作室现在能听懂中文和西班牙语指令,例如“添加供应商列”或“añade la columna Proveedor”。",
"投资页实时价格:股票和 ETF(印尼与美股)、加密货币和黄金按市场价更新。随时点“刷新价格”;你手动填写的价格会保留到你刷新为止。",
Expand All @@ -30,6 +33,7 @@
"桌面应用:即使第一次打开时没有网络也能使用;离线创建的预算会在联网后自动同步。"
],
"es": [
"Las plantillas salen en tu idioma: una petición en español, chino o indonesio da nombres de columna, listas, tarjetas y filas de ejemplo en ese idioma, y todas las fórmulas siguen funcionando.",
"Los enlaces pueden elegir el idioma: añade ?lang=es (o en, id, zh) y Budget, el mercado y las páginas legales se abren en ese idioma sin cambiar tu elección guardada.",
"El estudio de Plantillas entiende órdenes en chino y en español, como «añade la columna Proveedor» o 添加供应商列.",
"Precios en vivo en Invertir: acciones y ETF (IDX y EE. UU.), cripto y oro se actualizan con el mercado. Toca Actualizar precios cuando quieras; los precios que escribes tú se quedan hasta que actualices.",
Expand Down
19 changes: 13 additions & 6 deletions apps/mint/web/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@
return Core.generate(prompt, { currency: "IDR" }).spec.currency === Core.generate(prompt, { currency: "USD" }).spec.currency;
}

// The app language: templates from an unclear prompt ("budget") come out in it (core.js detects the rest).
function uiLang() {
return window.MintI18n && window.MintI18n.lang ? window.MintI18n.lang() : "en";
}

function withRegionCurrency(spec, prompt) {
var currency = regionCurrency();
if (currency === "USD" || spec.currency !== "USD" || promptNamesCurrency(prompt)) {
Expand All @@ -440,7 +445,7 @@
}
var cfg = aiConfig();
function fallback(err) {
var g = Core.generate(prompt, { currency: regionCurrency() });
var g = Core.generate(prompt, { currency: regionCurrency(), lang: uiLang() });
g.notes.unshift("AI unavailable (" + errorMessage(err) + ") \u2014 used the quick generator.");
return g;
}
Expand All @@ -460,7 +465,7 @@
return { spec: withRegionCurrency(spec, prompt), notes: notes };
}).catch(fallback);
} else {
path = Promise.resolve(Core.generate(prompt, { currency: regionCurrency() }));
path = Promise.resolve(Core.generate(prompt, { currency: regionCurrency(), lang: uiLang() }));
}
return path.then(function (g) {
draft = { spec: g.spec, templateId: null };
Expand Down Expand Up @@ -536,8 +541,10 @@
if (!draft) {
view.innerHTML = "<section class=\"narrow\"><h1>Create a template</h1>" + promptBox("studioPrompt", true) +
"<h2 class=\"mt\">\u2026or start from a blueprint</h2><div class=\"grid\">" + Core.BLUEPRINTS.map(function (bp) {
var l = { id: bp.id, title: bp.title, columns: bp.columns.map(function (c) { return c[0]; }), theme: bp.theme };
return "<button class=\"lcard asbutton\" data-blueprint=\"" + bp.id + "\">" + thumb(l) + "<div class=\"lbody\"><div class=\"ltitle\">" + esc(bp.title) + "</div><div class=\"lmeta\">" + esc(bp.category) + "</div></div></button>";
var lang = uiLang();
var title = Core.templateText(bp.title, lang);
var l = { id: bp.id, title: title, columns: bp.columns.map(function (c) { return Core.templateText(c[0], lang); }), theme: bp.theme };
return "<button class=\"lcard asbutton\" data-blueprint=\"" + bp.id + "\">" + thumb(l) + "<div class=\"lbody\"><div class=\"ltitle\">" + esc(title) + "</div><div class=\"lmeta\">" + esc(bp.category) + "</div></div></button>";
}).join("") + "</div></section>";
return;
}
Expand Down Expand Up @@ -723,8 +730,8 @@
var spec = draft && draft.spec;
if (b.dataset.blueprint) {
var bp = Core.blueprintById(b.dataset.blueprint);
draft = { spec: Core.specFromBlueprint(bp), templateId: null };
tweakLog = [{ who: "mint", text: "Started from the \u201c" + bp.title + "\u201d blueprint." }];
draft = { spec: Core.localizeSpec(Core.specFromBlueprint(bp), uiLang()), templateId: null };
tweakLog = [{ who: "mint", text: "Started from the \u201c" + draft.spec.title + "\u201d blueprint." }];
saveDraftLocal();
viewStudio();
return;
Expand Down
Loading
Loading