Skip to content

Commit

Permalink
[fix] Redirect to default locale issue and missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-ito-deltatre committed Dec 4, 2024
1 parent fc8dcf3 commit b57bc7f
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 20 deletions.
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export default defineConfig({
rollupOptions: {
external: ["/pagefind/pagefind.js"],
},
redirects: false,
},
vite: {
optimizeDeps: { exclude: ['auth:config'] },
Expand All @@ -73,6 +72,7 @@ export default defineConfig({
locales: LOCALES,
routing: {
prefixDefaultLocale: true,
redirectToDefaultLocale: true
}
}
});
10 changes: 9 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"header": {
"main": "Windows on Arm Ready Software"
"main": "Windows on Arm Ready Software",
"applications": "Windows on Arm Ready Applications",
"applications_desc": "Find applications ready for Windows on Arm",
"games": "Windows on Arm Ready Games",
"games_desc": "Find Games ready for Windows on Arm",
"contributing_app": "Windows on Arm - Contributing Applications form",
"contributing_app_desc": "Contributing form for Applications ready for Windows on Arm",
"contributing_game": "Windows on Arm - Contributing Games form",
"contributing_game_desc": "Contributing form for Games ready for Windows on Arm"
},
"bradcrumbs": {
"home": "Home",
Expand Down
10 changes: 9 additions & 1 deletion public/locales/ja/translation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"header": {
"main": "Arm向けのWindows対応ソフトウェア"
"main": "Arm向けのWindows対応ソフトウェア",
"applications": "Windows on Arm 対応アプリケーション",
"applications_desc": "Windows on Arm に対応したアプリケーションを探す",
"games": "Windows on Arm 対応ゲーム",
"games_desc": "Windows on Arm に対応したゲームを探す",
"contributing_app": "Windows on Arm - アプリケーション提供フォーム",
"contributing_app_desc": "Windows on Arm 対応アプリケーションの提供フォーム",
"contributing_game": "Windows on Arm - ゲーム提供フォーム",
"contributing_game_desc": "Windows on Arm 対応ゲームの提供フォーム"
},
"bradcrumbs": {
"home": "ホーム",
Expand Down
10 changes: 9 additions & 1 deletion public/locales/ko/translation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"header": {
"main": "Arm용 Windows 호환 소프트웨어"
"main": "Arm용 Windows 호환 소프트웨어",
"applications": "Windows on Arm 지원 애플리케이션",
"applications_desc": "Windows on Arm에서 실행 가능한 애플리케이션 찾기",
"games": "Windows on Arm 지원 게임",
"games_desc": "Windows on Arm에서 실행 가능한 게임 찾기",
"contributing_app": "Windows on Arm - 애플리케이션 기여 양식",
"contributing_app_desc": "Windows on Arm 지원 애플리케이션 기여 양식",
"contributing_game": "Windows on Arm - 게임 기여 양식",
"contributing_game_desc": "Windows on Arm 지원 게임 기여 양식"
},
"bradcrumbs": {
"home": "",
Expand Down
10 changes: 9 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"header": {
"main": "适用于Arm的Windows就绪软件"
"main": "适用于Arm的Windows就绪软件",
"applications": "Windows on Arm 兼容应用程序",
"applications_desc": "查找适用于 Windows on Arm 的应用程序",
"games": "Windows on Arm 兼容游戏",
"games_desc": "查找适用于 Windows on Arm 的游戏",
"contributing_app": "Windows on Arm - 应用程序贡献表单",
"contributing_app_desc": "适用于 Windows on Arm 的应用程序贡献表单",
"contributing_game": "Windows on Arm - 游戏贡献表单",
"contributing_game_desc": "适用于 Windows on Arm 的游戏贡献表单"
},
"bradcrumbs": {
"home": "主页",
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/InfoLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { LOCALES } from "../config/i18nConfig";
import { t } from "i18next";
const { frontmatter } = Astro.props;
console.log("From InfoLayout");
console.log(Astro.props);
let title = frontmatter.title + " | " + t('header.main');
let breadcrumbs = [{ href: `${Astro.url.pathname}`, title: frontmatter.title }];
const localeSegment = Astro.url.pathname.startsWith('/') ? Astro.url.pathname.replace(/\/$/, '').slice(1) : Astro.url.pathname;
Expand Down
1 change: 0 additions & 1 deletion src/pages/[lang]/applications/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { type CollectionEntry, getCollection, getEntry } from "astro:content";
import ProjectLayout from "../../../layouts/ProjectLayout.astro";
import { exec } from "node:child_process";
import { promisify } from "node:util";
import i18next from "i18next";
import { LOCALES } from "../../../config/i18nConfig";
const execAsync = promisify(exec);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/[lang]/applications/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const locale = updateLanguage(Astro.url);
---

<BaseLayout
title={"Windows on Arm Ready Applications"}
description={`Find applications ready for Windows on Arm`}
title={t('header.applications')}
description={t('header.applications_desc')}
breadcrumbs={[{ title: t('bradcrumbs.applications'), href: `/${locale}/applications` }]}
>
<div class="flex mx-auto mx-auto mt-12 text-3xl">
Expand Down
4 changes: 2 additions & 2 deletions src/pages/[lang]/applications/search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const locale = updateLanguage(Astro.url);
---

<BaseLayout
title={"Windows on Arm Ready Applications"}
description={`Find applications ready for Windows on Arm`}
title={t('header.applications')}
description={t('header.applications_desc')}
breadcrumbs={[
{ title: t('bradcrumbs.applications'), href: `/${locale}/applications` },
{ title: t('bradcrumbs.search'), href: `/${locale}/applications/search` }
Expand Down
4 changes: 2 additions & 2 deletions src/pages/[lang]/contributing/applications.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const recaptcha_url = `https://www.google.com/recaptcha/api.js?hl=${locale}`;
---

<BaseLayout
title={"Windows on Arm - Contributing Applications form"}
description={`Contributing form for Applications ready for Windows on Arm`}
title={t('header.contributing_app')}
description={t('header.contributing_app_desc')}
breadcrumbs={[
{ title: t('bradcrumbs.contributing'), href: `/${locale}/contributing` },
{ title: t('application_form.title'), href: `/${locale}/contributing/applications` }
Expand Down
4 changes: 2 additions & 2 deletions src/pages/[lang]/contributing/games.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const recaptcha_url = `https://www.google.com/recaptcha/api.js?hl=${locale}`;
---

<BaseLayout
title={"Windows on Arm - Contributing Games form"}
description={`Contributing form for Games ready for Windows on Arm`}
title={t('header.contributing_game')}
description={t('header.contributing_game_desc')}
breadcrumbs={[
{ title: t('bradcrumbs.contributing'), href: `/${locale}/contributing`, },
{ title: t('game_form.title'), href: `/${locale}/contributing/games` }
Expand Down
1 change: 0 additions & 1 deletion src/pages/[lang]/games/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ProjectLayout from "../../../layouts/ProjectLayout.astro";
import { exec } from "node:child_process";
import { promisify } from "node:util";
import { getEntry } from "astro:content";
import i18next from "i18next";
import { LOCALES } from "../../../config/i18nConfig";
const execAsync = promisify(exec);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/[lang]/games/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const locale = updateLanguage(Astro.url);
---

<BaseLayout
title={"Windows on Arm Ready Games"}
description={`Find Games ready for Windows on Arm`}
title={t('header.games')}
description={t('header.games_desc')}
breadcrumbs={[{ title: t('bradcrumbs.games'), href: `/${locale}/games` }]}
>
<Search shouldRedirect={false} type="games" />
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
import { DEFAULT_LOCALE } from "../config/i18nConfig";
Astro.redirect(`/${DEFAULT_LOCALE}/`);
---

<html>
Expand Down

0 comments on commit b57bc7f

Please sign in to comment.