public function testDynamicHeaders() { $translations = Gettext\Extractors\Po::fromFile(__DIR__ . '/files/gettext_multiple_headers.po'); $jsonString = Gettext\Generators\Jed::toString($translations, __DIR__ . '/files/gettext_multiple_headers.json', true); $domain = 'testingdomain'; $jedJson = json_decode($jsonString, true); $this->assertTrue(!empty($jedJson[$domain]) && $jedJson[$domain]['']['domain'] === $domain, "Domain '{$domain}' either missing or invalid"); $language = 'bs'; $this->assertEquals($language, $jedJson[$domain]['']['lang'], 'language does not match expected'); }
$translation->setTranslation($original_translation); if ($plural) { $translation->setPlural($plural); if ($plural_translation) { $translation->setPluralTranslation($plural_translation, 0); } } } } if (!file_exists(dirname($file_with_translations))) { mkdir(dirname($file_with_translations), 0775, true); chmod(dirname($file_with_translations), 0775); } Gettext\Generators\PhpArray::generateFile($entries, $file_with_translations); if ($file_extension == 'js') { Gettext\Generators\Jed::generateFile($entries, 'locale/' . $lang . '/' . $file_to_translate); } ?> <div style="color: green">Saved Successfully</div><?php } ?> <!DOCTYPE html> <h1><?php echo $file_to_translate; ?> </h1> <h4><?php echo $lang; ?> </h4>