Could anyone please help me out to translate the entire website content?
I am using ClientConfig extra/plugin to display global content, besides displaying a common resources data in the footer for every page using getResourceField extra/plugin but I don’t know how to translate them. I am using Babel for translation.
I have read out Bob’s documentation about lexicon but haven’t understood. I request someone to explain easily.
Thanks in advance.
It looks like you’re hard-coding the resource with id 2 in your getResourceField snippet calls. This will only load values from the web context because that’s where resource 2 is.
In your screenshot, I can see that you’ve probably got resource 2 in the web context, linked with resource 36 in your ‘English’ context via Babel, right?
So, one way to automatically load the correct value would be to use context settings. Add a context setting called common_resources_id to both contexts. In the ‘Website’ context, make the value of the setting 2. In the ‘English’ context, make the value 36.
Then, change your chunk code to call getResourceField using the new context setting:
The context aware mode of ClientConfig sounds like it would suit your use-case better:
Though, if you need to use the global mode, I think you’ll need to create two of each setting using different cultureKey values.
If you’re using babel then I’m guessing you’ve already got context settings on each context for cultureKey, yeah? I’m going to assume that one is de and one is en.
So, if you needed a clientconfig field called address, instead you would create one called address_en and one called address_de. Then in your chunk/template, you could reference it with: