Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Special characters (and MooTools) are ruining my life

I'm working on localization for my toolkit.

My goal is that if you were a German web developer and you wanted to use a forEach loop, rather then type ['hey', 'there'].forEach(function () {}); they could type ['hey', 'there'].fürJeder(function () {});

I have all the words stored in an object at $.i18n.de.

In my JavaScript file I have

de: {
    extend: 'verlänger',
    forEach: 'fürJeder'
}

but when I go into the object to get the words they turn into verlänger and fürJeder.

I have no idea why.

Some details:

  • I'm on a MacBook Pro running 10.6.7
  • I'm using Kod as my editor.
  • I'm using Google Chrome as my browser.
  • I'm using Option + U + letter to type the ä and ü.

My question: How do I get the browser to handle these correctly?

I've tried using backslashes before them but it stays the same.

EDIT: Screw it. I just found out that the people who inspired me to do this did it as an April Fool's day joke. I really should've clicked on some of those links. It would've saved me 2 hours of trying to set up an API.

like image 677
McKayla Avatar asked Nov 05 '22 23:11

McKayla


1 Answers

Turns out that this is a really bad idea to try and do.

Programming languages are almost exclusively written in English (JavaScript being one of those) which means that even if you write your program in a different language, keywords like return, var, function are still going to be in English and you're still going to have to use them which would get confusing when using functions, constants etc. that have non-English names.

The best solution is to just avoid using non-latin characters in variable names all together.

Even thought it works in most modern browsers, it makes your code harder to write and more confusing.

Leave the coding to the English speakers.

like image 107
McKayla Avatar answered Nov 09 '22 17:11

McKayla