git.p6c8.net
/
jirafeau_mojo42.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[TASK] Fix weblate warning regarding ku lang.
[jirafeau_mojo42.git]
/
lib
/
lang.php
diff --git
a/lib/lang.php
b/lib/lang.php
index 3bdef6a5cff622680489acd3d9cc828cd3ae1a3c..cfb8f80cf7aa290325f10a83d6a35f417137cb00 100644
(file)
--- a/
lib/lang.php
+++ b/
lib/lang.php
@@
-1,7
+1,7
@@
<?php
/*
* Jirafeau, your web file repository
<?php
/*
* Jirafeau, your web file repository
- * Copyright (C) 2015 Jerome Jutteau <j
.jutteau@gmail.com
>
+ * Copyright (C) 2015 Jerome Jutteau <j
erome@jutteau.fr
>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@
-40,13
+40,15
@@
function t($string_id)
return "FIX ME";
}
return "FIX ME";
}
-function t_visitor_langs() {
+function t_visitor_langs()
+{
$visitor_langs = t_parse_accept_language();
array_push($visitor_langs, "en");
return $visitor_langs;
}
$visitor_langs = t_parse_accept_language();
array_push($visitor_langs, "en");
return $visitor_langs;
}
-function t_parse_accept_language() {
+function t_parse_accept_language()
+{
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
return [];
}
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
return [];
}
@@
-63,7
+65,8
@@
function t_parse_accept_language() {
return $langs;
}
return $langs;
}
-function t_in($string_id, $lang) {
+function t_in($string_id, $lang)
+{
$trans = t_get_json($lang);
if ($trans === false) {
return false;
$trans = t_get_json($lang);
if ($trans === false) {
return false;
@@
-74,7
+77,8
@@
function t_in($string_id, $lang) {
return $trans[$string_id];
}
return $trans[$string_id];
}
-function t_get_raw_json($lang) {
+function t_get_raw_json($lang)
+{
$filename = str_replace("-", "_", $lang);
if (preg_match('/[^A-Za-z_\w]/', $filename)) {
return false;
$filename = str_replace("-", "_", $lang);
if (preg_match('/[^A-Za-z_\w]/', $filename)) {
return false;
@@
-90,7
+94,8
@@
function t_get_raw_json($lang) {
return $json;
}
return $json;
}
-function t_get_json($lang) {
+function t_get_json($lang)
+{
$raw_j = t_get_raw_json($lang);
$array = json_decode($raw_j, true);
if ($array === null) {
$raw_j = t_get_raw_json($lang);
$array = json_decode($raw_j, true);
if ($array === null) {
@@
-99,14
+104,15
@@
function t_get_json($lang) {
return $array;
}
return $array;
}
-function json_lang_generator($lang) {
+function json_lang_generator($lang)
+{
$r = false;
if ($lang === null) {
$lang_config = $GLOBALS['cfg']['lang'];
if ($lang_config != "auto") {
$r = t_get_raw_json($lang_config);
} else {
$r = false;
if ($lang === null) {
$lang_config = $GLOBALS['cfg']['lang'];
if ($lang_config != "auto") {
$r = t_get_raw_json($lang_config);
} else {
- foreach(t_visitor_langs() as $lang) {
+ foreach
(t_visitor_langs() as $lang) {
$r = t_get_raw_json($lang);
if (!($r === false)) {
break;
$r = t_get_raw_json($lang);
if (!($r === false)) {
break;
patrick-canterino.de