pierrejeambrun commented on code in PR #54008:
URL: https://github.com/apache/airflow/pull/54008#discussion_r2251224216


##########
airflow-core/src/airflow/ui/src/i18n/config.ts:
##########
@@ -37,13 +37,17 @@ export const supportedLanguages = [
 export const defaultLanguage = "en";
 export const namespaces = ["common", "dashboard", "dags", "admin", "browse", 
"assets", "components"] as const;
 
+const baseHref = document.querySelector("head > base")?.getAttribute("href") 
?? "";
+const baseUrl = new URL(baseHref, globalThis.location.origin);
+const basePath = new URL(baseUrl).pathname.replace(/\/$/u, "");
+
 void i18n
   .use(Backend)
   .use(LanguageDetector)
   .use(initReactI18next)
   .init({
     backend: {
-      loadPath: "/static/i18n/locales/{{lng}}/{{ns}}.json",
+      loadPath: `${basePath}/static/i18n/locales/{{lng}}/{{ns}}.json`,

Review Comment:
   This last commit doesn't look right. I don't think this will remove trailing 
slashes in the `basePath`. Ending up in double `//` in the `loadPath` (which 
isn't harmful but not very clean)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to