Permalink
Browse files

API-CHANGE: parser for new i18n syntax

  • Loading branch information...
1 parent 45c7dfd commit 189c305c8385d76ec8e8e8f9320992bbf3c90006 Julian Seidenberg committed Apr 16, 2012
Showing with 1,638 additions and 1,380 deletions.
  1. +1 −25 tests/i18n/i18nTest.php
  2. +1,600 −1,339 view/SSTemplateParser.php
  3. +37 −16 view/SSTemplateParser.php.inc
@@ -171,14 +171,10 @@ function testTemplateTranslation() {
i18n::set_locale('en_US');
i18n::get_translator('core')->getAdapter()->addTranslation(array(
'i18nTestModule.MAINTEMPLATE' => 'Main Template',
- 'i18nTestModule.ss.SPRINTFNONAMESPACE' => 'My replacement no namespace: %s',
'i18nTestModule.LAYOUTTEMPLATE' => 'Layout Template',
- 'i18nTestModule.ss.LAYOUTTEMPLATENONAMESPACE' => 'Layout Template no namespace',
'i18nTestModule.SPRINTFNAMESPACE' => 'My replacement: %s',
'i18nTestModule.WITHNAMESPACE' => 'Include Entity with Namespace',
- 'i18nTestModuleInclude.ss.NONAMESPACE' => 'Include Entity without Namespace',
'i18nTestModuleInclude.ss.SPRINTFINCLUDENAMESPACE' => 'My include replacement: %s',
- 'i18nTestModuleInclude.ss.SPRINTFINCLUDENONAMESPACE' => 'My include replacement no namespace: %s'
), 'en_US');
$viewer = new SSViewer('i18nTestModule');
@@ -187,22 +183,14 @@ function testTemplateTranslation() {
"Layout Template\n",
$parsedHtml
);
- $this->assertContains(
- "Layout Template no namespace\n",
- $parsedHtml
- );
i18n::set_locale('de_DE');
i18n::get_translator('core')->getAdapter()->addTranslation(array(
'i18nTestModule.MAINTEMPLATE' => 'TRANS Main Template',
- 'i18nTestModule.ss.SPRINTFNONAMESPACE' => 'TRANS My replacement no namespace: %s',
'i18nTestModule.LAYOUTTEMPLATE' => 'TRANS Layout Template',
- 'i18nTestModule.ss.LAYOUTTEMPLATENONAMESPACE' => 'TRANS Layout Template no namespace',
'i18nTestModule.SPRINTFNAMESPACE' => 'TRANS My replacement: %s',
'i18nTestModule.WITHNAMESPACE' => 'TRANS Include Entity with Namespace',
- 'i18nTestModuleInclude.ss.NONAMESPACE' => 'TRANS Include Entity without Namespace',
'i18nTestModuleInclude.ss.SPRINTFINCLUDENAMESPACE' => 'TRANS My include replacement: %s',
- 'i18nTestModuleInclude.ss.SPRINTFINCLUDENONAMESPACE' => 'TRANS My include replacement no namespace: %s'
), 'de_DE');
$viewer = new SSViewer('i18nTestModule');
@@ -216,10 +204,6 @@ function testTemplateTranslation() {
$parsedHtml
);
$this->assertContains(
- "TRANS Layout Template no namespace",
- $parsedHtml
- );
- $this->assertContains(
"TRANS My replacement: TestPropertyValue",
$parsedHtml
);
@@ -228,18 +212,10 @@ function testTemplateTranslation() {
$parsedHtml
);
$this->assertContains(
- "TRANS Include Entity without Namespace",
- $parsedHtml
- );
- $this->assertContains(
"TRANS My include replacement: TestPropertyValue",
$parsedHtml
);
- $this->assertContains(
- "TRANS My include replacement no namespace: TestPropertyValue",
- $parsedHtml
- );
-
+
i18n::set_locale($oldLocale);
}
Oops, something went wrong. Retry.

0 comments on commit 189c305

Please sign in to comment.