Internationalization of CMS pages
I understand that pages generated with the CMS plugin can be localized. But how does it work? Are there translation files and if yes where do they need to be stored? Or do I have to implement this manually by using site variables and page fields?
Answers (5)
As far as I understood you should create one page for each language where the slug is the same. Then you can use the filter {{ page | in_locale: 'your-language-id' }} .
Hello. On the mentioned points, please contact our support team at support@redmineup.com. Thanks.
Sorry, I forgot to explain that your page structure should reflect the language. That is, /page/en/blog and /page/de/blog, for example.
Hello. On the mentioned points, please contact our support team at support@redmineup.com. Thanks.
Hi! Thank you for your reply.
I made a quick test and it seems not to work.
I made 5 pages:
help
en
en/help
de
de/help
content of page 'de/help':
<h1>Hilfe</h1>
<p>Dies ist die deutsche Hilfeseite</p>
content of page 'en/help':
<h1>Help</h1>
<p>This is the english help page. </p>
content of page 'help' includes language selection:
{% assign p = page | in_locale: 'de' %}
users.current.language: {{ users.current.language }}
{{ p.content }}
calling /pages/help
renders the page 'de/help', so it works as expected.
Now I wanted to change the language and edited content of page 'help' to select 'en' instead of 'de':
{% assign p = page | in_locale: 'en' %}
users.current.language: {{ users.current.language }}
{{ p.content }}
calling /pages/help renders:
users.current.language: en {% assign p = page | in_locale: 'en' %} users.current.language: {{ users.current.language }} {{ p.content }}
So, the localized de page is found, but the localized en page not. Any ideas?
Hello. On the mentioned points, please contact our support team at support@redmineup.com. Thanks.
If your default language of Redmine is equal to the language given in 'in_locale:' then it won't work. My workaround was to change the default language in Redmine.
Ok, the workaround fixed it. Thank you!
But I still do not get why it does not work with the default language. Is this a known bug?
Hello. On the mentioned points, please contact our support team at support@redmineup.com. Thanks.
Hello. On the mentioned points, please contact our support team at support@redmineup.com. Thanks.