0

I'm trying to add two languages to my site, but I'm not sure, how to set up the URL for the language switch.

en.php and es.php contains separate languages:

$lang = array(
   "home" => "Home",
   "aboutus" => "About Us",      
);

header.php contains include('lang-switch.php');, which successfully switches languages <h3><?php printTranslatedString('aboutus') ?></h3>

if I go to some page like localhost/user/site/doc1.php?title=blog by clicking the language switch link from site/includes/navbar.php with <a class="nav-link" href="&lang=en">En</a> and &lang=es.

The URL changes to localhost/user/site/&lang=en, or localhost/user/site/&lang=en Object not found.

I have to set up the URL with an update of doc1.php? document and title= name with &lang= name like: localhost/user/site/doc1.php?title=blog&lang=es

2

1 Answer 1

1

You need to keep ?title=blog in url and add &lang=en/es after

You have a GET for the name page (blog) AND your lang :)

example : localhost/user/site/category.php?title=blog&lang=en

Sign up to request clarification or add additional context in comments.

3 Comments

Hello, sorry I've deleted the post by editing mistake. I've edited the post, please check it
Is it ok or you're still blocked? I'm not sure ahah
no, not blocked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.