28 February, 2009

Get browser language via JavaScript

This is simple cross-browser solution:

var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || 'en').substr(0, 2).toLowerCase();


And usage example:

var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || 'en').substr(0, 2).toLowerCase();
if (lang == 'ru') {
    document.write('Specific Russian text');
} else {
    document.write('Common English text');
}

24 February, 2009

PHP-reference

I'm happy to introduce one more my project: PHP-reference.

This is the interactive engine for PHP documentation: the client side is implemented with ExtJS/JavaScript, and PHP for server side.
It uses original PHP documentation (processed via regexps and colored with CSS styles) as a data source.

I've tried to create it as usable as possible... any requests, ideas welcome!