-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge(dev) Rename namespace to Wdes\phpI18nL10n
- Loading branch information
Showing
15 changed files
with
39 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
namespace Wdes\phpI18nL10n\Tests; | ||
|
||
use \PHPUnit\Framework\TestCase; | ||
use \Wdes\PIL\Twig\Extension\I18n as ExtensionI18n; | ||
use Wdes\phpI18nL10n\Twig\Extension\I18n as ExtensionI18n; | ||
use \Twig\Environment as TwigEnv; | ||
use \Twig\Loader\FilesystemLoader as TwigLoaderFilesystem; | ||
use \Wdes\PIL\plugins\MoReader; | ||
use \Wdes\PIL\Launcher; | ||
use \Wdes\PIL\Twig\MemoryCache; | ||
use Wdes\phpI18nL10n\plugins\MoReader; | ||
use Wdes\phpI18nL10n\Launcher; | ||
use Wdes\phpI18nL10n\Twig\MemoryCache; | ||
|
||
/** | ||
* @author William Desportes <[email protected]> | ||
|
@@ -72,7 +72,7 @@ public function testSimpleTranslation(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo \Wdes\PIL\Launcher::getPlugin()->gettext("Translate this");', | ||
'echo \Wdes\phpI18nL10n\Launcher::getPlugin()->gettext("Translate this");', | ||
$generatedCode | ||
); | ||
$html = $template->render([]); | ||
|
@@ -91,7 +91,7 @@ public function testSimpleTranslationWithComment(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo \Wdes\PIL\Launcher::getPlugin()->gettext("Translate this");', | ||
'echo \Wdes\phpI18nL10n\Launcher::getPlugin()->gettext("Translate this");', | ||
$generatedCode | ||
); | ||
$this->assertStringContainsString( | ||
|
@@ -115,7 +115,7 @@ public function testSimpleTranslationWithContext(): void | |
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
|
||
$this->assertStringContainsString( | ||
'echo \Wdes\PIL\Launcher::getPlugin()->pgettext("NayanCat", "Translate this");', | ||
'echo \Wdes\phpI18nL10n\Launcher::getPlugin()->pgettext("NayanCat", "Translate this");', | ||
$generatedCode | ||
); | ||
$html = $template->render([]); | ||
|
@@ -135,7 +135,8 @@ public function testSimpleTranslationWithContextAndVariable(): void | |
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
|
||
$this->assertStringContainsString( | ||
'echo strtr(\Wdes\PIL\Launcher::getPlugin()->pgettext("The user name", "Translate this %name%"), ["%name%" => ($context["name"] ?? null)]);', | ||
'echo strtr(\Wdes\phpI18nL10n\Launcher::getPlugin()->pgettext("The user name", "Translate this %name%"), ' | ||
. '["%name%" => ($context["name"] ?? null)]);', | ||
$generatedCode | ||
); | ||
$html = $template->render( | ||
|
@@ -159,7 +160,7 @@ public function testSimpleTranslationWithContextAndVariables(): void | |
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
|
||
$this->assertStringContainsString( | ||
'echo strtr(\Wdes\PIL\Launcher::getPlugin()->pgettext("The user name", "Translate this %key%: %value%"), ' | ||
'echo strtr(\Wdes\phpI18nL10n\Launcher::getPlugin()->pgettext("The user name", "Translate this %key%: %value%"), ' | ||
. '["%key%" => ($context["key"] ?? null), "%value%" => ($context["value"] ?? null)]);', | ||
$generatedCode | ||
); | ||
|
@@ -184,7 +185,7 @@ public function testPluralTranslation(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo strtr(\Wdes\PIL\Launcher::getPlugin()->ngettext("One person"'. | ||
'echo strtr(\Wdes\phpI18nL10n\Launcher::getPlugin()->ngettext("One person"'. | ||
', "%nbr% persons", abs(($context["nbr_persons"] ?? null))),'. | ||
' ["%nbr%" => ($context["nbr"] ?? null)]);', | ||
$generatedCode | ||
|
@@ -205,7 +206,7 @@ public function testPluralTranslationWithComment(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo strtr(\Wdes\PIL\Launcher::getPlugin()->ngettext('. | ||
'echo strtr(\Wdes\phpI18nL10n\Launcher::getPlugin()->ngettext('. | ||
'"one user likes this.", "%nbr% users likes this.",'. | ||
' abs(($context["nbr_persons"] ?? null))),'. | ||
' ["%nbr%" => ($context["nbr"] ?? null)]);', | ||
|
@@ -231,7 +232,7 @@ public function testSimplePluralTranslation(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo \Wdes\PIL\Launcher::getPlugin()->ngettext("One person", "persons", abs(($context["a"] ?? null)));', | ||
'echo \Wdes\phpI18nL10n\Launcher::getPlugin()->ngettext("One person", "persons", abs(($context["a"] ?? null)));', | ||
$generatedCode | ||
); | ||
$html = $template->render(["nbr" => 5]); | ||
|
@@ -252,7 +253,7 @@ public function testSimplePluralTranslationCount(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo \Wdes\PIL\Launcher::getPlugin()->ngettext("One person",'. | ||
'echo \Wdes\phpI18nL10n\Launcher::getPlugin()->ngettext("One person",'. | ||
' "persons", abs(twig_get_attribute($this->env, $this->source,'. | ||
' ($context["a"] ?? null), "count", [], "any", false, false, false, 1)));', | ||
$generatedCode | ||
|
@@ -273,7 +274,7 @@ public function testSimplePluralTranslationCountAndVars(): void | |
); | ||
$generatedCode = $this->memoryCache->extractDoDisplayFromCache($template); | ||
$this->assertStringContainsString( | ||
'echo strtr(\Wdes\PIL\Launcher::getPlugin()->ngettext("One person",'. | ||
'echo strtr(\Wdes\phpI18nL10n\Launcher::getPlugin()->ngettext("One person",'. | ||
' "persons and %count% dogs", abs(twig_get_attribute($this->env,'. | ||
' $this->source, ($context["a"] ?? null), "count", [], "any", false, false, false, 1))),'. | ||
' ["%count%" => abs(twig_get_attribute($this->env,'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ | |
use Twig\Node\Expression\NameExpression; | ||
use \Twig\Environment as TwigEnv; | ||
use \Twig\Loader\FilesystemLoader as TwigLoaderFilesystem; | ||
use \Wdes\PIL\Twig\TranslationNode; | ||
use \Wdes\PIL\Twig\MemoryCache; | ||
use Wdes\phpI18nL10n\Twig\TranslationNode; | ||
use Wdes\phpI18nL10n\Twig\MemoryCache; | ||
|
||
/** | ||
* @author William Desportes <[email protected]> | ||
|