Split findLanguage() into 3 function, write some tests

Conflicts:
	lib/l10n.php
Fix variable name. Prevent $accept_langs from being type casted.
Change == to ===
Fix cherry-pick error
Fix whitespace issue
Merge branch 'pr-rewrite_l10n' into nctubox

Conflicts:
	lib/l10n.php
	tests/lib/l10n.php