GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BdR76/MultiLanguage: JavaScript multi-language localisation using a json file to add UI translation to websites or games

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
index.html
index.html
 
 
languages.json
languages.json
 
 
multilang.js
multilang.js
 
 
readme.md
readme.md
 
 
style.css
style.css
 
 

Repository files navigation

MultiLang.js

MultiLang.js is a JavaScript object to handle multilanguage, localisation, JSON file loading, detect default language, detect non-existing phrases etc.

It contains a working example page and a JSON example file with multiple languages. Initially created for Phaser.js games, but it can be applied to any JavaScript project or website.

How to use

Store two or more translations in a JSON file, for example languages.json like this:

{
    "en": {
        "Hello": "Hello World!",
        "SaveChanges": "Do you want to save the changes?",
        "Yes": "Yes",
        "No": "No"
    },
    "fr": {
        "Hello": "Bonjour à tous!",
        "SaveChanges": "Voulez-vous sauvegarder les modifications?",
        "Yes": "Oui",
        "No": "Non"
    },
    "zh": {
        "Hello": "大家好",
        "SaveChanges": "是否要保存更改?",
        "Yes": "要",
        "No": "不要"
    }
}

And then MultiLang.js can be used like this:

var multilang = new MultiLang('languages.json');
multilang.setLanguage('fr');
alert( multilang.get('Hello') );

Manage translations

Keeping track of all the translated strings can be a challenge, even for smaller projects. See this Excel spreadsheet to manage translations more easily. The translator(s) can fill the spreadsheet with translated texts and the JSON file can then be generated using a Excel VBA or LibreOffice macro. For more information see here.

Also see the Manage translations github page

spreadsheet --> macro --> JSON
                          XML strings
                          String.localization
                          resx

History

2016-oct-28 upload project on github

Send any questions or comments to Bas de Reuver - [email protected]

About

JavaScript multi-language localisation using a json file to add UI translation to websites or games

Topics

languageslocalisationlocalizationmultilanguagetranslationtranslation-managementtranslations

Resources

Readme
Activity

Stars

36 stars

Watchers

2 watching

Forks

12 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.