aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config/ConfigJson.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-09 18:12:15 +0200
committerArthurHoaro <arthur@hoa.ro>2017-10-22 12:55:03 +0200
commit12266213d098a53c5f005b9afcbbe62771fd580c (patch)
treec7adfb280272fee16a5e2011f55315f838a07395 /application/config/ConfigJson.php
parent72cfe44436f4316112fc4aabfe8940aa7b4adcab (diff)
downloadShaarli-12266213d098a53c5f005b9afcbbe62771fd580c.tar.gz
Shaarli-12266213d098a53c5f005b9afcbbe62771fd580c.tar.zst
Shaarli-12266213d098a53c5f005b9afcbbe62771fd580c.zip
Shaarli's translation
* translation system and unit tests * Translations everywhere Dont use translation merge It is not available with PHP builtin gettext, so it would have lead to inconsistency.
Diffstat (limited to 'application/config/ConfigJson.php')
-rw-r--r--application/config/ConfigJson.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php
index 9ef2ef56..8c8d5610 100644
--- a/application/config/ConfigJson.php
+++ b/application/config/ConfigJson.php
@@ -22,10 +22,15 @@ class ConfigJson implements ConfigIO
22 $data = json_decode($data, true); 22 $data = json_decode($data, true);
23 if ($data === null) { 23 if ($data === null) {
24 $errorCode = json_last_error(); 24 $errorCode = json_last_error();
25 $error = 'An error occurred while parsing JSON configuration file ('. $filepath .'): error code #'; 25 $error = sprintf(
26 $error .= $errorCode. '<br>➜ <code>' . json_last_error_msg() .'</code>'; 26 'An error occurred while parsing JSON configuration file (%s): error code #%d',
27 $filepath,
28 $errorCode
29 );
30 $error .= '<br>➜ <code>' . json_last_error_msg() .'</code>';
27 if ($errorCode === JSON_ERROR_SYNTAX) { 31 if ($errorCode === JSON_ERROR_SYNTAX) {
28 $error .= '<br>Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as '; 32 $error .= '<br>';
33 $error .= 'Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as ';
29 $error .= '<a href="http://jsonlint.com/">jsonlint.com</a>.'; 34 $error .= '<a href="http://jsonlint.com/">jsonlint.com</a>.';
30 } 35 }
31 throw new \Exception($error); 36 throw new \Exception($error);
@@ -44,8 +49,8 @@ class ConfigJson implements ConfigIO
44 if (!file_put_contents($filepath, $data)) { 49 if (!file_put_contents($filepath, $data)) {
45 throw new \IOException( 50 throw new \IOException(
46 $filepath, 51 $filepath,
47 'Shaarli could not create the config file. 52 t('Shaarli could not create the config file. '.
48 Please make sure Shaarli has the right to write in the folder is it installed in.' 53 'Please make sure Shaarli has the right to write in the folder is it installed in.')
49 ); 54 );
50 } 55 }
51 } 56 }