Skip to content

Commit

Permalink
Fix small translation mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
kacan98 committed Apr 14, 2024
1 parent 7b6c9e5 commit b0f1c4b
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 26 deletions.
3 changes: 2 additions & 1 deletion i18next-scanner.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ module.exports = {
list: ["t"], // Include the 't' function
extensions: [".ts", ".tsx"], // Scan TypeScript and TSX files
},
lngs: ["en", "de", "cz", "dk", "se"],
lngs: ["en", "de", "cz", "dk", "se", "ro"],
defaultLng: "en",
resource: {
loadPath: "i18n/{{lng}}/{{ns}}.json",
savePath: "i18n/{{lng}}/{{ns}}.json",
override: false, // Do not override the existing JSON files
},
},
};
5 changes: 4 additions & 1 deletion public/i18n/cz/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Detaily kapitálu z prodeje",
"Currency": "Měna",
"Start over": "Začít znovu",
"Select currency": "Vyberte měnu"
"Select currency": "Vyberte měnu",
"Language": "Jazyk",
"Select language": "Vyberte jazyk",
"Monthly costs of buying": "Měsíční náklady na koupi"
}
5 changes: 4 additions & 1 deletion public/i18n/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Details zum Kapital aus dem Verkauf",
"Currency": "Währung",
"Start over": "Neu starten",
"Select currency": "Währung auswählen"
"Select currency": "Währung auswählen",
"Language": "Sprache",
"Select language": "Sprache auswählen",
"Monthly costs of buying": "Monatliche Kosten des Kaufens"
}
5 changes: 4 additions & 1 deletion public/i18n/dk/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Detaljer om kapital fra salg",
"Currency": "Valuta",
"Start over": "Start forfra",
"Select currency": "Vælg valuta"
"Select currency": "Vælg valuta",
"Language": "Sprog",
"Select language": "Vælg sprog",
"Monthly costs of buying": "Månedlige omkostninger ved køb"
}
5 changes: 4 additions & 1 deletion public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Details of Capital from Selling",
"Currency": "Currency",
"Start over": "Start Over",
"Select currency": "Select Currency"
"Select currency": "Select Currency",
"Language": "Language",
"Select language": "Select Language",
"Monthly costs of buying": "Monthly Costs of Buying"
}
5 changes: 4 additions & 1 deletion public/i18n/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Detalii capital din vânzare",
"Currency": "Monedă",
"Start over": "Începe din nou",
"Select currency": "Selectează moneda"
"Select currency": "Selectează moneda",
"Language": "Limba",
"Select language": "Selectează limba",
"Monthly costs of buying": "Costuri lunare de cumpărare"
}
5 changes: 4 additions & 1 deletion public/i18n/se/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"Capital from selling details": "Detaljer om kapital från försäljning",
"Currency": "Valuta",
"Start over": "Börja om",
"Select currency": "Välj valuta"
"Select currency": "Välj valuta",
"Language": "Språk",
"Select language": "Välj språk",
"Monthly costs of buying": "Månadskostnader för köp"
}
26 changes: 16 additions & 10 deletions src/components/result/buyingChart.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LineChart } from "@mui/x-charts";
import { PeriodValueChange } from "../../services/buying/buying.model.ts";
import { useTranslation } from "react-i18next";
import { Typography } from "@mui/material";

function BuyingChart({ graphData }: { graphData: PeriodValueChange[] }) {
const { t } = useTranslation();
Expand Down Expand Up @@ -58,16 +59,21 @@ function BuyingChart({ graphData }: { graphData: PeriodValueChange[] }) {

if (graphData.length === 0) return <></>;
return (
<LineChart
xAxis={[
{
valueFormatter: (value) => value.toString(),
data: years,
},
]}
series={labelObjects}
{...customize}
/>
<>
<Typography variant={"caption"}>
{t("Monthly costs of buying")}:
</Typography>
<LineChart
xAxis={[
{
valueFormatter: (value) => value.toString(),
data: years,
},
]}
series={labelObjects}
{...customize}
/>
</>
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/settingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export function SettingsDialog(props: SimpleDialogProps) {
if (value) {
i18n.changeLanguage(value);
dispatch(setLocale(value));
toggleLanguageDialog(false);
onClose();
}
toggleLanguageDialog(false);
};

const settings: {
Expand Down Expand Up @@ -95,6 +95,7 @@ export function SettingsDialog(props: SimpleDialogProps) {
break;
case "startOver":
localStorage.removeItem("state");
localStorage.removeItem("i18nextLng");
//refresh page
window.location.reload();
break;
Expand Down
2 changes: 0 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { CssBaseline } from "@mui/material";
import { I18nextProvider } from "react-i18next";
import i18n from "./i18n.ts";

console.log(i18n);

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<CssBaseline />
Expand Down
2 changes: 1 addition & 1 deletion src/services/useAlternativeInvestment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function useAlternativeInvestmentReturns() {
const { totalAtTheEnd, monthlyValues, valueAdded, allMonthlyInvestment } =
calculateInvestmentReturns({
initialInvestment: initialCash,
monthlyInvestment: moneyAvailablePerMonth,
monthlyInvestment: moneyAvailablePerMonth * 12,
numberOfPeriods: yearsStaying,
appreciationRate: alternativeInvestmentReturnPercentage / 100,
});
Expand Down
1 change: 1 addition & 0 deletions store/calculatorSlices/useCalculatorSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function useCalculatorSlice<T extends keyof CalculatorState>(

const createFloatStateUpdateFc = (fieldName: keyof CalculatorState[T]) => {
return (e: React.ChangeEvent<HTMLInputElement>) => {
// @ts-expect-error - this is a hack to get around the fact that the type of the action is not known at compile time
const action = createAction[sliceName];
const value = parseFloat(e.target.value || "0");
dispatch(
Expand Down
20 changes: 15 additions & 5 deletions store/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { combineReducers, configureStore } from "@reduxjs/toolkit";
import { combineReducers, configureStore, Store } from "@reduxjs/toolkit";
import { buyingSlice } from "./calculatorSlices/buying.ts";
import { futurePredictionsSlice } from "./calculatorSlices/futurePreditions.ts";
import { rentingSlice } from "./calculatorSlices/renting.ts";
Expand All @@ -12,15 +12,25 @@ const calculatorReducers = combineReducers({
});

const persistedState = loadFromLocalStorage();

const reducer = combineReducers({
calculator: calculatorReducers,
settings: settingsSlice.reducer,
});

export const store = configureStore({
reducer,
preloadedState: persistedState,
});
export let store: Store;

try {
store = configureStore({
reducer,
preloadedState: persistedState,
});
} catch (e) {
console.error(e);
store = configureStore({
reducer,
});
}

store.subscribe(() => saveToLocalStorage(store.getState()));

Expand Down

0 comments on commit b0f1c4b

Please sign in to comment.