Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple language Websites - Feature Request or Theme topic ?
#1
Nearly all my projects need support for 2 or more languages

My idea is to create a component offering a language switch - e.g. EN | DE
Within this component to run some regex on <?php get_page_url(); ?> exchanging the individual country shortcut within the Slug/URL- name:

xyz.com/en-test becomes xyz.com/de-test and vice-versa

Unfortunately I didn't find suitable regex (but will continue to check)

Anybody having a better / more elegant solution ?
Reply
#2
wizzy Wrote:Unfortunately I didn't find suitable regex (but will continue to check)

found a solution - converts any page slug/url containing -de- or -en- or -es- into links to the corresponding pages

HOW?

1) define a new component and paste the following php code:

Code:
<?php
    $srcurl = $_SERVER["REQUEST_URI"];
    echo '<a href="'.ereg_replace("-de-|-es-","-en-",$srcurl).'" title="english">en</a> | ';
    echo '<a href="'.ereg_replace("-en-|-es-","-de-",$srcurl).'" title="deutsch">de</a> | ';
    echo '<a href="'.ereg_replace("-en-|-de-","-es-",$srcurl).'" title="espa&ntilde;ol">es</a>';
?>

2) paste get_component() wherever you want to offer the language- switch

3) enjoy!
Reply
#3
don't quite get the usage of this component?
Reply
#4
Well this component automatically generates links for alternative languages out of the URL the current viewed page has.

Imagine the URL is: http://www.xyz.com/-de-test the component outputs:

Code:
<a href="/-en-test" title="english">en</a> |
<a href="/-de-test" title="deutsch">de</a> |
<a href="/-es-test" title="español">es</a>

Now you store your pages with the following prefix in their name:
-en-pagename for english pages
-de-pagename for german pages
-es-pagename for spanish pages

As soon as you are on one of those pages you click on the language switch to change to the related other language pages...

For sure the languages can be adapted - but those are the languages I need in my project.

Open issue: up to now the menu contains all pages in all languages - but I am sure we find a way to only show one language - by running some ereg_replace on get_navigation(return_page_slug());
Reply
#5
yep that's what i was curious. so menu is still the issue
Reply
#6
Prepare a Rock Solid Test Environment and Use it
For a Website hosted in English and Japanese Language, it’s not a ball in the browser’s court to change the language of the browser and run the desired test scripts for it. So there comes the need of 2 machines with different language settings in the Desired OS. This is required as users from different countries install OS with their choice of language and generally don’t change their language settings to view a website.

Knowing the Language or having a language translator is a must
If a Speaker of the desired language, belonging to the same region is usually the best person to help in translations, but if it’s not the ball in your court, then use of different translation websites are available like wordreference.com, googletranslate.com, dictionary.com. It is always a good habit to compare results from different translation websites.

Get Maximum Knowledge of the Website
If the functionality for the website with all the business rules for the application is dead clear to you then changing language and checking for functionality for the website with other languages will be a low level headache and will explore the doors as how to test in other language versions.

for more information refer
http://www.mindfiresolutions.com/Test-a-...es-660.php
Reply




Users browsing this thread: 1 Guest(s)