fix: translate backend add log
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m48s

This commit is contained in:
Thibaut Valentin 2026-01-16 13:59:12 +01:00
parent 4bf07cc8f8
commit c456fdae8b
3 changed files with 10 additions and 2 deletions

View File

@ -21,11 +21,15 @@ public class UserInfoProvider implements ContainerRequestFilter {
@Override @Override
public void filter(ContainerRequestContext requestContext) { public void filter(ContainerRequestContext requestContext) {
System.out.println(requestContext.getHeaders());
List<Locale> acceptableLanguages = requestContext.getAcceptableLanguages(); List<Locale> acceptableLanguages = requestContext.getAcceptableLanguages();
System.out.println(acceptableLanguages);
Locale selectedLocale = findFirstSupportedLanguage(acceptableLanguages); Locale selectedLocale = findFirstSupportedLanguage(acceptableLanguages);
if (selectedLocale == null) if (selectedLocale == null)
selectedLocale = TradService.fallbackLocale; selectedLocale = TradService.fallbackLocale;
System.out.println(selectedLocale);
requestContext.setProperty("userLocale", selectedLocale); requestContext.setProperty("userLocale", selectedLocale);
} }

View File

@ -655,7 +655,7 @@ function combsPage() {
rootDiv.append(content) rootDiv.append(content)
} }
export async function initCompetitionApi(apiUrlRoot_) { export async function initCompetitionApi(apiUrlRoot_, host) {
apiUrlRoot = apiUrlRoot_; apiUrlRoot = apiUrlRoot_;
const options = { const options = {
@ -663,6 +663,10 @@ export async function initCompetitionApi(apiUrlRoot_) {
caches: [], caches: [],
} }
const backend = {
loadPath: `${host}/locales/{{lng}}/{{ns}}.json`,
}
await i18next await i18next
.use(i18nextHttpBackend) .use(i18nextHttpBackend)
.use(i18nextBrowserLanguagedetector) .use(i18nextBrowserLanguagedetector)

View File

@ -225,7 +225,7 @@ function Menu({menuActions, compUuid}) {
<div id='safca_api_data'></div> <div id='safca_api_data'></div>
<script type="module"> <script type="module">
import {initCompetitionApi} from '${vite_url}/competition.js'; import {initCompetitionApi} from '${vite_url}/competition.js';
initCompetitionApi("${vite_url}/api/public/result/${compUuid}") initCompetitionApi("${vite_url}/api/public/result/${compUuid}", "${vite_url}")
</script>` </script>`
).then(() => { ).then(() => {
toast.success(t('texteCopiéDansLePresse')); toast.success(t('texteCopiéDansLePresse'));