diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-28 05:12:43 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-28 05:12:43 +0000 |
commit | e8df1cd6911b8f5a75e67a731fcb44b36581b8b4 (patch) | |
tree | 8e1d03420b9908170481bccad50e0bb6e4ff14f8 | |
parent | 5c5bd8034915fd81fc292251949479ab3f69ce20 (diff) | |
download | brdo-e8df1cd6911b8f5a75e67a731fcb44b36581b8b4.tar.gz brdo-e8df1cd6911b8f5a75e67a731fcb44b36581b8b4.tar.bz2 |
#654726 by bdurbin, sun, plach, et al: Fixed Installing Drupal 7 in non-English language doesn't pick up st() installation lists.
-rw-r--r-- | includes/install.inc | 8 | ||||
-rw-r--r-- | modules/locale/locale.test | 38 |
2 files changed, 40 insertions, 6 deletions
diff --git a/includes/install.inc b/includes/install.inc index 11b1a35c2..23a7137b8 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -849,10 +849,14 @@ function install_goto($path) { * @see t() * @ingroup sanitization */ -function st($string, $args = array()) { +function st($string, array $args = array(), array $options = array()) { static $locale_strings = NULL; global $install_state; + if (empty($options['context'])) { + $options['context'] = ''; + } + if (!isset($locale_strings)) { $locale_strings = array(); if (isset($install_state['parameters']['profile']) && isset($install_state['parameters']['locale'])) { @@ -883,7 +887,7 @@ function st($string, $args = array()) { case '!': } } - return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args); + return strtr((!empty($locale_strings[$options['context']][$string]) ? $locale_strings[$options['context']][$string] : $string), $args); } /** diff --git a/modules/locale/locale.test b/modules/locale/locale.test index a2add4610..6f82b9e3e 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -958,6 +958,35 @@ EOF; } /** + * Tests for the st() function. + */ +class LocaleInstallTest extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'String translation using st()', + 'description' => 'Tests that st() works like t().', + 'group' => 'Locale', + ); + } + + function setUp() { + parent::setUp('locale'); + + // st() lives in install.inc, so ensure that it is loaded for all tests. + require_once DRUPAL_ROOT . '/includes/install.inc'; + } + + /** + * Verify that function signatures of t() and st() are equal. + */ + function testFunctionSignatures() { + $reflector_t = new ReflectionFunction('t'); + $reflector_st = new ReflectionFunction('st'); + $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), t('Function signatures of t() and st() are equal.')); + } +} + +/** * Locale uninstall with English UI functional test. */ class LocaleUninstallFunctionalTest extends DrupalWebTestCase { @@ -1106,7 +1135,7 @@ class LocaleUninstallFrenchFunctionalTest extends LocaleUninstallFunctionalTest /** * Functional tests for the language switching feature. */ -class LanguageSwitchingFunctionalTest extends DrupalWebTestCase { +class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase { public static function getInfo() { return array( @@ -1280,7 +1309,7 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase { /** * Functional test for language handling during user creation. */ -class LocalUserCreationTest extends DrupalWebTestCase { +class LocaleUserCreationTest extends DrupalWebTestCase { public static function getInfo() { return array( @@ -1606,7 +1635,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { * http://example.cn/admin/config * UI language in Chinese */ -class UILanguageNegotiationTest extends DrupalWebTestCase { +class LocaleUILanguageNegotiationTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'UI language negotiation', @@ -1904,7 +1933,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { /** * Functional tests for localizing date formats. */ -class LocalizeDateFormatsFunctionalTest extends DrupalWebTestCase { +class LocaleDateFormatsFunctionalTest extends DrupalWebTestCase { public static function getInfo() { return array( @@ -1969,3 +1998,4 @@ class LocalizeDateFormatsFunctionalTest extends DrupalWebTestCase { $this->assertText($french_date, t('French date format appears')); } } + |