Hi, it's possible translate subfolders for diferent languages? For example in spanish hi have /noticias/new-1 and in english /news/new-1.
Grav only accept 1 name for the subfolder, it's have a solution?
Thanks
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
Solved by pamtbaau View solution
Hi, it's possible translate subfolders for diferent languages? For example in spanish hi have /noticias/new-1 and in english /news/new-1.
Grav only accept 1 name for the subfolder, it's have a solution?
Thanks
@javiregpa The documentation has a separate chapter on Multi-language websites.
In short, a page can have multiple translations but they share one and the same folder.
The name of the file tells Grav which language it contains. Eg.
/user/pages/
01.noticias/ <-- If Spanish is the main language, use Spanish name as folder name
default.en.md <-- English file
default.es.md <-- Spanish file
If you are on the Spanish part of the website, you will have a url to the news page like 'http://mydomain/noticias'.
In the 'default.en.md' you tell Grav what the English title and the English URL must be:
---
title: News <-- This will be used as the title of the menuitem
slug: news <-- This will be part of the url
---
The url for the English version of the page will then be http://mydomain/en/news
For this all to work, you have to tell Grav that you want to show multiple languages. You can do this in '/user/config/system.yaml:
languages:
supported: [es, en] <-- This will tell Grav that Spanish is the main language and English an alternative
include_default_lang: false <-- Tell Grav not to use a language extension in url for main language.
For more detailed information I would like to refer to the above mentioned documentation.
Hope this helps...
Thanks for the response @pamtbaau
good to know, thanks!
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 2 | 53 | 11 hours ago | ||
| 2 | 60 | 13 hours ago | ||
| 1 | 30 | 14 hours ago | ||
| 2 | 65 | 5 days ago | ||
| 2 | 56 | 5 days ago |