[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] LanguageTranslations: Add missing commas for new entries

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6894fe40b9c85_2c1dae11064455@gitlab-sidekiq-low-urgency-cpu-bound-v2-d8f58d6d8-mwg7w.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
d00502f9 by Bruno Kambere at 2025-08-07T19:20:02+00:00
[FIX] LanguageTranslations: Add missing commas for new entries
---
* [FIX] LanguageTranslations: Add missing commas for new entries

See merge request tikiwiki/tiki!8189

- - - - -


1 changed file:

- lib/language/LanguageTranslations.php


Changes:

=====================================
lib/language/LanguageTranslations.php
=====================================
@@ -225,6 +225,15 @@ class LanguageTranslations extends TikiDb_Bridge
             // convert every entry in the array $dbTrans (translations that are not present in language.php)
             // to a string in the format '"original string" => "translation"'
             $newTrans = [];
+            // Ensure the previous line has a comma if it doesn't already
+            if ($lastStr > 0) {
+                $prevLine = trim($langFile[$lastStr - 1]);
+                // Check if previous line is a translation entry without a trailing comma
+                if (preg_match('/^".*"\s*=>\s*".*"$/', $prevLine)) {
+                    $langFile[$lastStr - 1] = rtrim($langFile[$lastStr - 1]) . ",\n";
+                }
+            }
+
             foreach ($dbTrans as $orig => $trans) {
                 $newTrans[] = '"' . $orig . '" => "' . $trans . "\",\n";
                 $stats['new']++;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d00502f9b8c2c2d79e1590ab226ab4419368a4e4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d00502f9b8c2c2d79e1590ab226ab4419368a4e4
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.