[ACCEPTED]-Write JavaScript in Other Languages-multilingual
JavaScript isn't written in English, it's 1 written in JavaScript.
JavaScript's keywords are in English and 6 browsers' object names are in English. You 5 can't get around this. Even if all of your 4 variable and function names are in French, you'll 3 still need to have English keywords lying 2 around. Your clients will have to live with 1 this.
You can get any object and assign it to 5 a variable with a French name for instance
var nomAppDeNavigateur = navigator.appName;
Then 4 use it wherever, it's just the keywords 3 that are restricted to Javascriptish. It 2 still has to make sense though, whatever 1 language you are aiming for.
JavaScript is a dynamic language that responds 4 well to monkey-patching:
String.prototype.indice= String.prototype.indexOf;
navigator.nomApp= navigator.appName;
window.navigatrice= navigator;
Et voilà! Your code 3 fragment works as-is. Well, except for the 2 curious way your browser is masculine.
PS. Don't 1 do this.
I highly suggest you do not do this. I also 6 think this is not possible. Not only are 5 you throwing away tons of documentation 4 which uses only english but you are making 3 it very difficult for non-french speaking 2 people to code with your application.
See 1 Jeff Atwoods post about this here:
Most programming languages are based off 17 of the English language.
As Jeff pointed 16 out in a recent blog post, Eric Raymond notes that 15 functional English is required for true hackers:
Back around 1991 I learned that many hackers 14 who have English as a second language 13 use it in technical discussions even when 12 they share a birth tongue; it was reported 11 to me at the time that English has a richer technical 10 vocabulary than any other language and 9 is therefore simply a better tool for 8 the job. For similar reasons, translations 7 of technical books written in English 6 are often unsatisfactory (when they get 5 done at all).
On a related note, also pointed 4 out in Jeff's post, Wikipedia keeps a list 3 of non-English based programming languages.
Either your client must learn basic 2 English or they must use a non-English based 1 language.
Programming language keywords are fixed. The 4 browser can't translate them from one spoken 3 language to another. Functions you create 2 yourself can be in any spoken language you 1 chose.
In JS as in any other language you can define 4 your own classes/methods in the language 3 you want but the standart libraries are 2 usually written in english so that's what 1 you have...
You are perfectly able to write your own 9 variables, functions and APIs in other languages; however, the 8 vast majority of existing APIs are going 7 to be in English and there is no way for 6 the browser to understand that you ment 5 navigator
when you write navigateur
.
Ostensibly, you could write 4 a translation framework that would translate 3 French keywords and French API calls into 2 their English counterparts, but that would 1 be a whole lot of work.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.