Home Best solutions for multi-language website
Reply: 1

Best solutions for multi-language website

Mik Roe Hollywood Games
1#
Mik Roe Hollywood Games Published in 2017-12-07 22:30:38Z

I'm currently having a regular HTML website in multiple languages. I've tried something with PHP, but that didn't turned out very well. What I need is a Multi language site without: - Subdomains (like en.domain.tld) - Paths (like domain.tld/en)

What I do need: - Languages that are stored in sessions/cookies - Languages which can be used around the whole site (with one place to store the language files, if that's necessary) - Preferably without visible indications in the URL (like ?lang=en).

A bit like how Google does it, because I also have multiple TLDs, so the user shouldn't be required to change their language by visiting another domain like .de, if they set their language to English from the .com site.

What is the best solution for this? I'm also very new to making websites, so that's why I'm asking.

Robert I
2#
Robert I Reply to 2017-12-07 22:42:26Z

What i prefer to do is

  1. Create a localization directory at the top level of your app

index.html

app.js

localization/

  1. Inside localization directory create two files

web-en.json

{
"title":"Hello world",
"desc":"languages are fun"
}

web-es.json

{
"title":"Hola Mundo",
"desc":"idiomas son divertidos"
}
  1. Install this library "jquery-localize": "https://github.com/coderifous/jquery-localize.git"

bower install jquery-localize

  1. Include the library

  2. Add the attributes to your HTML tags

    Hello World will go here Translated desc will replace this text
  3. Call the library onReady

$(function(){ $("[data-localize]").localize("localization/web"); };

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306602 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO