GenCode - When generating 'setup/res/languages.php', it should be pass linter
authorTim Otten <totten@civicrm.org>
Fri, 17 Nov 2023 01:30:16 +0000 (17:30 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 17 Nov 2023 01:46:40 +0000 (17:46 -0800)
CRM/Core/CodeGen/I18n.php

index 4fbe3a31f1949a6bcac4383d8a2a99737b1615a4..91cb6e117628bf310fb88d91ae1eb93708602daf 100644 (file)
@@ -21,7 +21,11 @@ class CRM_Core_CodeGen_I18n extends CRM_Core_CodeGen_BaseTask {
     }
     // @todo Somewhere in 2024 or beyond, deprecate the old installer
     file_put_contents('../install/langs.php', "<?php \$langs = " . var_export($langs, TRUE) . ";");
-    file_put_contents('../setup/res/languages.php', "<?php\n\n\Civi\Setup::assertRunning();\n\n\$langs = " . var_export($langs, TRUE) . ";");
+
+    // The `Template` helper provides PHP code cleanup.
+    $tpl = new CRM_Core_CodeGen_Util_Template('php');
+    $tpl->assign('langs', var_export($langs, TRUE));
+    $tpl->run('languages_setup.tpl', '../setup/res/languages.php');
   }
 
   public function generateSchemaStructure(): void {