Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/i18n cli #345

Closed
wants to merge 3 commits into from
Closed
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
16 changes: 16 additions & 0 deletions apps/dashboard/languine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "1.0.0",
"locale": {
"source": "en",
"targets": ["sv"]
},
"files": {
"ts": {
"include": ["src/locales/[locale].ts"]
}
},
"openai": {
"model": "gpt-4"
},
"instructions": "Make the tone more for a Fintech/Accounting tool"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ChangeLanguage } from "@/components/change-language";
import { ChangeTimezone } from "@/components/change-timezone";
import { DateFormatSettings } from "@/components/date-format-settings";
import { LocaleSettings } from "@/components/locale-settings";
Expand All @@ -19,6 +20,7 @@ export default async function Page() {
return (
<div className="space-y-12">
<LocaleSettings locale={userData?.locale} />
<ChangeLanguage />
<ChangeTimezone timezone={userData?.timezone} timezones={timezones} />
<TimeFormatSettings timeFormat={userData?.time_format} />
<DateFormatSettings dateFormat={userData?.date_format} />
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/components/change-language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import {
import { useAction } from "next-safe-action/hooks";

export function ChangeLanguage() {
const action = useAction(updateUserAction);
// const action = useAction(updateUserAction);
const changeLocale = useChangeLocale();
const locale = useCurrentLocale();
const t = useI18n();

const handleOnChange = async (locale: string) => {
await action.execute({ locale });
const handleOnChange = (locale: string) => {
// await action.execute({ locale });
changeLocale(locale);
};

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/locales/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { createI18nClient } from "next-international/client";

// NOTE: Also update middleware.ts to support locale
export const languages = ["en"];
export const languages = ["en", "sv"];

export const {
useScopedI18n,
Expand All @@ -13,5 +13,5 @@ export const {
useI18n,
} = createI18nClient({
en: () => import("./en"),
// sv: () => import("./sv"),
sv: () => import("./sv"),
});
2 changes: 1 addition & 1 deletion apps/dashboard/src/locales/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { createI18nServer } from "next-international/server";

export const { getI18n, getScopedI18n, getStaticParams } = createI18nServer({
en: () => import("./en"),
// sv: () => import("./sv"),
sv: () => import("./sv"),
});
187 changes: 164 additions & 23 deletions apps/dashboard/src/locales/sv.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export default {
transaction_methods: {
card_purchase: "Kortbetalning",
card_purchase: "Kortköp",
payment: "Betalning",
card_atm: "Kort bankomat",
card_atm: "Kort ATM",
transfer: "Överföring",
other: "Annan",
other: "Annat",
ach: "Ach",
deposit: "Deposition",
deposit: "Insättning",
wire: "Wire",
fee: "Avgift",
interest: "Ränta",
Expand All @@ -16,42 +16,57 @@ export default {
description: "Ändra språket som används i användargränssnittet.",
placeholder: "Välj språk",
},
locale: {
title: "Lokal",
searchPlaceholder: "Sök lokal",
description:
"Ställer in regionen och språkinställningarna för valuta, datum och andra lokal-specifika format.",
placeholder: "Välj lokal",
},
languages: {
en: "Engelska",
sv: "Svenska",
},
timezone: {
title: "Tidzon",
description: "Aktuell tidzoninställning.",
placeholder: "Välj tidzon",
},
inbox_filter: {
all: "Alla",
todo: "Att göra",
done: "Slutförda",
title: "Tidszon",
searchPlaceholder: "Sök tidszon",
description:
"Definierar den standard tidszon som används för att visa tider i appen.",
placeholder: "Välj tidszon",
},
spending_period: {
last_30d: "Senaste 30 dagarna",
this_month: "Den här månaden",
this_month: "Denna månad",
last_month: "Förra månaden",
this_year: "Det här året",
this_year: "Detta år",
last_year: "Förra året",
},
transactions_period: {
all: "All",
all: "Alla",
income: "Inkomst",
outcome: "Utgifter",
expense: "Utgifter",
},
transaction_frequency: {
weekly: "Veckovis återkommande",
monthly: "Månadsvis återkommande",
annually: "Årligen återkommande",
},
inbox_filter: {
all: "Alla",
todo: "Att göra",
done: "Klar",
},
chart_type: {
profit: "Vinst",
revenue: "Omsättning",
burn_rate: "Brännhastighet",
revenue: "Intäkter",
expense: "Utgifter",
burn_rate: "Burn rate",
},
folders: {
all: "Alla",
exports: "Exporteringar",
exports: "Export",
inbox: "Inkorg",
imports: "Importer",
imports: "Import",
transactions: "Transaktioner",
invoices: "Fakturor",
},
Expand All @@ -64,10 +79,136 @@ export default {
member: "Medlem",
},
tracker_status: {
in_progress: "Pågående",
completed: "Färdig",
in_progress: "Pågår",
completed: "Slutförd",
},
notifications: {
inbox: "Få notifikationer om nya objekt i din inkorg.",
match: "Få notifikationer om matchningar.",
transaction: "Få notifikationer om en ny transaktion.",
transactions: "Få notifikationer om nya transaktioner.",
"invoice.paid": "Få notifikationer om betalda fakturor.",
"invoice.overdue": "Få notifikationer om försenade fakturor.",
"inbox.match": "Få notifikationer om nya matchningar i din inkorg.",
},
widgets: {
insights: "Assistent",
inbox: "Inkorg",
spending: "Utgifter",
transactions: "Transaktioner",
tracker: "Tracker",
},
bottom_bar: {
"transactions#one": "1 Transaktion",
"transactions#other": "{count} Transaktioner",
multi_currency: "Multi valuta",
description: "Inkluderar transaktioner från alla sidor av resultat",
},
account_type: {
depository: "Depå",
credit: "Kredit",
other_asset: "Annan tillgång",
loan: "Lån",
other_liability: "Annan skuld",
},
tags: {
bylaws: "Stadgar",
shareholder_agreements: "Aktieägaravtal",
board_meeting: "Styrelsemöte",
corporate_policies: "Företagspolicyer",
annual_reports: "Årsredovisningar",
budget_reports: "Budgetrapporter",
audit_reports: "Revisionsrapporter",
tax_returns: "Skattedeklarationer",
invoices_and_receipts: "Fakturor & Kvittot",
employee_handbook: "Anställdas handbok",
payroll_records: "Löneuppgifter",
performance_reviews: "Prestationsbedömningar",
employee_training_materials: "Utbildningsmaterial för anställda",
benefits_documentation: "Förmånsdokumentation",
termination_letters: "Uppsägningsbrev",
patents: "Patent",
trademarks: "Varumärken",
copyrights: "Upphovsrätt",
client_contracts: "Kundkontrakt",
financial_records: "Finansiella uppgifter",
compliance_reports: "Efterlevnadsrapporter",
regulatory_filings: "Regulatoriska inlämningar",
advertising_copy: "Reklamkopia",
press_releases: "Pressmeddelanden",
branding_guidelines: "Varumärkesriktlinjer",
market_research_reports: "Marknadsundersökningsrapporter",
campaign_performance_reports: "Kampanjprestationsrapporter",
customer_surveys: "Kundenkäter",
quality_control_reports: "Kvalitetskontrollrapporter",
inventory_reports: "Lager rapporter",
maintenance_logs: "Underhållsloggar",
production_schedules: "Produktionsscheman",
vendor_agreements: "Leverantörsavtal",
supplier_agreements: "Leverantörsavtal",
sales_contracts: "Försäljningskontrakt",
sales_reports: "Försäljningsrapporter",
client_proposals: "Kundförslag",
customer_order_forms: "Kundorderformulär",
sales_presentations: "Försäljningspresentationer",
data_security_plans: "Datasäkerhetsplaner",
system_architecture_diagrams: "Systemarkitekturdiagram",
incident_response_plans: "Incidentresponsplaner",
user_manuals: "Användarmanualer",
software_licenses: "Programvarulicenser",
data_backup_logs: "Data backup-loggar",
project_plans: "Projektplaner",
task_lists: "Uppgiftslistor",
risk_management_plans: "Riskhanteringsplaner",
project_status_reports: "Projektstatusrapporter",
meeting_agendas: "Mötesagendor",
lab_notebooks: "Lab anteckningsböcker",
experiment_results: "Experimentresultat",
product_design_documents: "Produktdesign dokument",
prototypes_and_models: "Prototyper & Modeller",
testing_reports: "Testrapporter",
newsletters: "Nyhetsbrev",
email_correspondence: "E-postkorrespondens",
support_tickets: "Supportärenden",
faqs_and_knowledge: "FAQs & Kunskap",
user_guides: "Användarguider",
warranty_information: "Garantiinformation",
swot_analysis: "SWOT-analys",
strategic_objectives: "Strategiska mål",
roadmaps: "Roadmaps",
competitive_analysis: "Konkurrensanalys",
safety_data_sheets: "Säkerhetsdatablad",
compliance_certificates: "Efterlevnadscertifikat",
incident_reports: "Incidentrapporter",
emergency_response_plans: "Nödresponsplaner",
certification_records: "Certifieringsregister",
training_schedules: "Utbildningsscheman",
e_learning_materials: "E-lärningsmaterial",
competency_assessment_forms: "Kompetensbedömningsformulär",
},
invoice_status: {
draft: "Utkast",
overdue: "Försenad",
paid: "Betald",
unpaid: "Obetald",
canceled: "Avbruten",
},
payment_status: {
none: "Okänd",
good: "Bra",
average: "Medel",
bad: "Dålig",
},
payment_status_description: {
none: "Ingen betalningshistorik ännu.",
good: "Betalar konsekvent i tid.",
average: "För det mesta i tid.",
bad: "Rum för förbättring.",
},
"invoice_count#zero": "Inga fakturor",
"invoice_count#one": "1 faktura",
"invoice_count#other": "{count} fakturor",
account_balance: {
total_balance: "Total saldo",
total_balance: "Total balans",
},
} as const;
2 changes: 1 addition & 1 deletion apps/dashboard/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createI18nMiddleware } from "next-international/middleware";
import { type NextRequest, NextResponse } from "next/server";

const I18nMiddleware = createI18nMiddleware({
locales: ["en"],
locales: ["en", "sv"],
defaultLocale: "en",
urlMappingStrategy: "rewrite",
});
Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"name": "midday",
"private": true,
"workspaces": [
"packages/*",
"apps/*",
"packages/email/*"
],
"workspaces": ["packages/*", "apps/*", "packages/email/*"],
"scripts": {
"build": "turbo build",
"clean": "git clean -xdf node_modules",
Expand Down
1 change: 1 addition & 0 deletions packages/i18n/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env.local
31 changes: 31 additions & 0 deletions packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "languine",
"version": "1.0.0",
"private": true,
"type": "module",
"bin": "dist/index.js",
"main": "dist/index.js",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "biome check .",
"format": "biome format --write .",
"typecheck": "tsc --noEmit",
"test": "bun test src",
"build": "tsup src/index.ts --format esm --dts --clean",
"dev": "tsup src/index.ts --format esm --watch --clean",
"start": "node dist/index.js"
},
"dependencies": {
"@ai-sdk/openai": "^1.0.7",
"@clack/prompts": "^0.8.2",
"chalk": "^5.3.0",
"dedent": "^1.5.3",
"dotenv": "^16.4.7",
"gradient-string": "^3.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
"tsup": "^8.0.2",
"typescript": "^5.3.3"
}
}
Loading
Loading