Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

How to setup multi-lingual website?

Solved by pamtbaau View solution

Started by Javi 8 years ago · 3 replies · 643 views
8 years ago

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

👍 1
8 years ago Solution

@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.

TXT
/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:

YAML
---
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:

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...

👍 2
8 years ago

Thanks for the response @pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 53 11 hours ago
Support · by Anna, 3 days ago
2 60 13 hours ago
Support · by Justin Young, 14 hours ago
1 30 14 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago