[Scummvm-git-logs] scummvm-web master -> e1e4b119fa646a9f9e3880e687c402cca35e3242

Mataniko mataniko at gmail.com
Sun Nov 3 21:04:05 CET 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
e1e4b119fa "I18N: Add Greek language support to the website"


Commit: e1e4b119fa646a9f9e3880e687c402cca35e3242
    https://github.com/scummvm/scummvm-web/commit/e1e4b119fa646a9f9e3880e687c402cca35e3242
Author: Matan Bareket (mataniko at gmail.com)
Date: 2019-11-03T15:03:41-05:00

Commit Message:
"I18N: Add Greek language support to the website"

Changed paths:
    include/I18N.php
    public_html/index.php


diff --git a/include/I18N.php b/include/I18N.php
index 92ec587..218de4b 100644
--- a/include/I18N.php
+++ b/include/I18N.php
@@ -20,7 +20,7 @@ class I18N
         $config = \HTMLPurifier_Config::createDefault();
         $this->purifier = new \HTMLPurifier($config);
 
-        $langs = ['en', 'it', 'fr', 'ru', 'de'];
+        $langs = ['en', 'it', 'fr', 'ru', 'de', 'el'];
         foreach ($langs as $key => $value) {
             $this->convertLanguageJsonToSmartyIni('lang.' . $value);
             $this->updateNewsI18n($value);
@@ -36,6 +36,7 @@ class I18N
 
         $output = "";
         foreach ($json as $key => $value) {
+          if ($value)
             $output .= $key . " = " . $this->purifier->purify($value). "\n";
         }
 
@@ -47,15 +48,26 @@ class I18N
 
         // For non-english, create/overwrite JSON files from our i18n file
         if ($lang != 'en') {
+            if (!file_exists(DIR_NEWS . "/i18n/news.{$lang}.json")) return;
             echo("Converting " . DIR_NEWS . "/i18n/news.{$lang}.json to individual JSON files\n");
             $i18n = json_decode(file_get_contents(DIR_NEWS . "/i18n/news.{$lang}.json"));
 
             foreach ($i18n as $key => $value) {
                 $object = YamlFrontMatter::parse(file_get_contents(DIR_NEWS . "/{$key}.markdown"));
-                $title = $this->purifier->purify(str_replace('"', '\"', $value->title));
+
                 $date = $this->purifier->purify($object->date);
                 $author = $this->purifier->purify($object->author);
-                $content = $this->purifier->purify(trim($value->content));
+                if (array_key_exists('content', $value)) {
+                  $title = $this->purifier->purify(str_replace('"', '\"', $value->title));
+                } else {
+                  $title = $this->purifier->purify(str_replace('"', '\"', $object->title));
+                }
+                if (array_key_exists('content', $value)) {
+                  $content = $this->purifier->purify(trim($value->content));
+                } else {
+                  $content = $this->purifier->purify(trim($object->content));
+                }
+
 
                 $yaml = "---\ntitle: \"$title\"\ndate: $date\nauthor: $author\n---\n\n$content\n";
 
diff --git a/public_html/index.php b/public_html/index.php
index 7c893f9..36b6460 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -13,7 +13,8 @@ $available_languages = array(
   'de' => 'Deutsch',
   'fr' => 'Français',
   'it' => 'Italiano',
-  'ru' => 'Русский'
+  'ru' => 'Русский',
+  'el' => 'Greek'
 );
 
 function get_preferred_languages()





More information about the Scummvm-git-logs mailing list