summaryrefslogtreecommitdiffstats
path: root/app/app.php
diff options
context:
space:
mode:
authorPascal Chevrel <pascal@chevrel.org>2012-03-12 15:40:15 +0100
committerPascal Chevrel <pascal@chevrel.org>2012-03-12 15:40:15 +0100
commit5378cf37d8d3dde29a2e7a67e94f3966696288e6 (patch)
treed2beff7282a5e5e2ddcd870113117944587084a7 /app/app.php
parente6ab308bbdb024fe8f65f6e6419482d94dc54eab (diff)
downloadplanet-5378cf37d8d3dde29a2e7a67e94f3966696288e6.tar
planet-5378cf37d8d3dde29a2e7a67e94f3966696288e6.tar.gz
planet-5378cf37d8d3dde29a2e7a67e94f3966696288e6.tar.bz2
planet-5378cf37d8d3dde29a2e7a67e94f3966696288e6.tar.xz
planet-5378cf37d8d3dde29a2e7a67e94f3966696288e6.zip
l10n support for moonmoon
Diffstat (limited to 'app/app.php')
-rwxr-xr-x[-rw-r--r--]app/app.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/app/app.php b/app/app.php
index 1bb632c..d17c42e 100644..100755
--- a/app/app.php
+++ b/app/app.php
@@ -17,9 +17,30 @@ include_once(dirname(__FILE__).'/classes/PlanetFeed.php');
include_once(dirname(__FILE__).'/classes/PlanetItem.php');
include_once(dirname(__FILE__).'/classes/PlanetError.php');
include_once(dirname(__FILE__).'/classes/Planet.class.php');
+include_once(dirname(__FILE__).'/classes/Simplel10n.class.php');
+
+$savedConfig = dirname(__FILE__).'/../custom/config.yml';
+
+if (is_file($savedConfig)){
+
+ $conf = Spyc::YAMLLoad($savedConfig);
+
+ // this is a check to upgrade older config file without l10n
+ if(!isset($conf['locale'])) {
+ $resetPlanetConfig = new PlanetConfig($conf);
+ file_put_contents($savedConfig, $resetPlanetConfig->toYaml());
+ $conf = Spyc::YAMLLoad($savedConfig);
+ }
-if (is_file(dirname(__FILE__).'/../custom/config.yml')){
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml');
$PlanetConfig = new PlanetConfig($conf);
$Planet = new Planet($PlanetConfig);
}
+
+$l10n = new Simplel10n($conf['locale']);
+
+// this is an helper function. We will usually use that function and not Simplel10n::getString()
+function _g($str) {
+ return Simplel10n::getString($str);
+}
+
+