Multi-language website folder and file structure

Asked

Viewed 35 times

0

Good morning,
I am structuring a multi-language website with the following sub-directories:

  • dominio.com/PT
  • domain.com/EN

I can have an index in each of these folders?

I ask this question because I wonder if I should have an index in domain.com that links to the language pages in the directories I created or if there are only index in the sub-directory directories.

Thank you.

  • 2

    Possible duplicate of How to translate a website into PHP?

  • My question relates to the structure of folders and files that need to be created on the hosting server and not exactly with the php commands needed to perform a text translation. Thank you.

  • Are you using any framework or CMS?

  • At this time the site is not yet published and I am creating it on my pc with visual studio code but I am in doubt about the structure of folders and files. Thank you.

1 answer

0


There are several ways to make such a structure, you can create a file where you will be saved all the texts of your site.

create a file for the languages you want example:

php.

<?php

$titulo = "Meu carro"
$descricao = "Um carro qualquer"

?>

php-text.

<?php

$titulo = "My car"
$descricao = "Any car"

?>

On your website instead of directly writing the texts you call the variables, if it is /pt you call the text-en.php file and so on

  • Thanks for the answer. My question is more related to the file structure that has to be created on the server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.