20if (! defined(
'NOREQUIREUSER')) define(
'NOREQUIREUSER',
'1');
21if (! defined(
'NOREQUIRESOC')) define(
'NOREQUIRESOC',
'1');
25if (! defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
27if (! defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
30if (! defined(
"NOLOGIN")) define(
"NOLOGIN",
'1');
39require
'../../main.inc.php';
55if (empty($dolibarr_nocache)) {
56 $delaycache =
'86400';
57 header(
'Cache-Control: max-age=' . $delaycache .
', public, must-revalidate');
58 header(
'Pragma: cache');
59 header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', time() + (
int) $delaycache) .
' GMT');
62 header(
'Cache-Control: no-cache');
64header(
'Content-Type: application/json; charset=utf-8');
69 $local = $langs->getDefaultLang();
74 echo json_encode([
'error' =>
'Missing domain']);
78if (!preg_match(
'/^[A-Za-z0-9_-]+(?:@[A-Za-z0-9_-]+)?$/', $domain)) {
79 echo json_encode([
'error' =>
'Invalid domain']);
84if (!preg_match(
'/^[a-z]{1,2}_[A-Z]{1,2}(?:,[a-z]{1,2}_[A-Z]{1,2})*$/', $local)) {
85 echo json_encode([
'error' =>
'Invalid langs codes']);
97$locals = explode(
',', $local);
100foreach ($locals as $langCode) {
101 $json->$langCode = [];
103 $outputlangs->setDefaultLang($langCode);
104 $outputlangs->load($domain);
105 foreach ($outputlangs->tab_translate as $k => $v) {
110print json_encode($json, JSON_PRETTY_PRINT);
Class to manage translations.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.