[Scummvm-git-logs] scummvm-web master -> 47577851718b7671843454345b1ffc763ccdc9b0

Mataniko mataniko at gmail.com
Sat Jan 4 19:11:06 UTC 2020


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:
4757785171 I18N: Replace non-breaking space in french URLs


Commit: 47577851718b7671843454345b1ffc763ccdc9b0
    https://github.com/scummvm/scummvm-web/commit/47577851718b7671843454345b1ffc763ccdc9b0
Author: Mataniko (mataniko at gmail.com)
Date: 2020-01-04T14:10:26-05:00

Commit Message:
I18N: Replace non-breaking space in french URLs

Changed paths:
    include/I18N.php


diff --git a/include/I18N.php b/include/I18N.php
index 5418dba..f3cca24 100644
--- a/include/I18N.php
+++ b/include/I18N.php
@@ -50,9 +50,9 @@ class I18N
     {
 
         // For non-english, create/overwrite JSON files from our i18n file
-        if ($lang != 'en') {
+        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");
+            echo("Converting " . DIR_NEWS . "/i18n/news.{$lang}.json to individual Markdown files\n");
             $i18n = json_decode(file_get_contents(DIR_NEWS . "/i18n/news.{$lang}.json"));
 
             foreach ($i18n as $key => $value) {
@@ -71,6 +71,12 @@ class I18N
                   $content = $this->purifier->purify(trim($object->content));
                 }
 
+                if ($lang === 'fr') {
+                    $content = preg_replace_callback("/(?<=\(http)(.*?)(?=\))/u",
+                    function($matches) {                        
+                        return preg_replace("/\x{202f}/u", "", $matches[1]);
+                    }, $content);                    
+                }
 
                 $yaml = "---\ntitle: \"$title\"\ndate: $date\nauthor: $author\n---\n\n$content\n";
 
@@ -81,7 +87,7 @@ class I18N
             }
         } else {
             // Update the base english i18n file
-            echo("Converting individual JSON files to I18N base file\n");
+            echo("Converting English Markdown files to the I18N base file\n");
             $newsJson = array();
             $news = $this->getAllNews($lang);
 




More information about the Scummvm-git-logs mailing list