Refactor i18n configuration and utility functions for improved clarity and simplicity
All checks were successful
SteamWarCI Build successful
All checks were successful
SteamWarCI Build successful
This commit is contained in:
@@ -24,4 +24,4 @@ export default defineAstroI18nConfig({
|
||||
"passwort-setzen": "set-password",
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,7 +47,6 @@ export default defineConfig({
|
||||
configFile: "./tailwind.config.js",
|
||||
applyBaseStyles: false,
|
||||
}),
|
||||
configureI18n(),
|
||||
sitemap({
|
||||
i18n: {
|
||||
defaultLocale: "en",
|
||||
|
||||
@@ -17,25 +17,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {l as proxyL} from "astro-i18n";
|
||||
import { l as proxyL } from "astro-i18n";
|
||||
|
||||
const locales = [
|
||||
"en",
|
||||
"de",
|
||||
];
|
||||
|
||||
export const l = (route: string) => {
|
||||
const transPath = proxyL(route);
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
return transPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const [_, locale, ...rest] = transPath.split("/");
|
||||
if (locales.includes(locale)) {
|
||||
return "/" + rest.join("/");
|
||||
}
|
||||
|
||||
return transPath;
|
||||
};
|
||||
export const l = proxyL;
|
||||
|
||||
Reference in New Issue
Block a user