Replies: 1 comment
-
You need to add your translation in public folders. class CustomBackend implements BackendModule {
static type: 'backend' = 'backend' as const;
type = 'backend' as const;
init(services: any, backendOptions: any, i18nextOptions: any): void {}
read(language: string, namespace: string, callback: ReadCallback): void {
import(`../../public/locales/${language}/${namespace}.json`)
.then((resources) => {
callback(null, resources.default);
})
.catch((error) => {
callback(error, false);
});
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to access the URL where oxygen will store my assets in a static way? For example through an env variable that is injected?
Use case: I am setting up remix-i18next for localisation and it requires you to set up a static helper that can be used to get translations in loaders and actions:
The load path won't work like this on oxygen of course, so as I understand I need to use the oxygen asset url to fetch the assets from the CDN.
I have found a
getOxygenAssetsUrl()
helper in the i18n PR, but this requires a request. At the time I am building the i18next object, I don't have a request yet. I could of course build this object for every request, but that seems inefficient, or I could build it for the first request and then cache it but that will complicate the code a lot.Is there some way to get the oxygen assets URL without a request? Maybe through env variables during deploy time?
In the github actions workflow there is mention of an
OXYGEN_ASSET_BASE_URL
but I'm not sure I understand how I can get that into my application.Beta Was this translation helpful? Give feedback.
All reactions