diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 0788461..35ef567 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -736,18 +736,25 @@ function locale_get_plural($count, $langcode = NULL) {
   $langcode = $langcode ? $langcode : $language->language;
 
   if (!isset($plurals[$langcode][$count])) {
-    if (empty($locale_formula)) {
+    // Retrieve and statically cache the plural formula for the language.
+    if (!isset($locale_formula[$langcode])) {
       $language_list = language_list();
       $locale_formula[$langcode] = $language_list[$langcode]->formula;
     }
-    if ($locale_formula[$langcode]) {
+    // If there is a plural formula for the language, evaluate it for the given
+    // $count and statically cache the result for the combination of language
+    // and count, since the result will always be identical.
+    if (!empty($locale_formula[$langcode])) {
       $n = $count;
       $plurals[$langcode][$count] = @eval('return intval(' . $locale_formula[$langcode] . ');');
-      return $plurals[$langcode][$count];
     }
+    // In case there is no plural formula for English, use a default formula.
+    elseif ($langcode == 'en') {
+      $plurals[$langcode][$count] = (int) ($count != 1);
+    }
+    // Otherwise, return -1 (unknown).
     else {
       $plurals[$langcode][$count] = -1;
-      return -1;
     }
   }
   return $plurals[$langcode][$count];
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 42a6dbc..c777d35 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -606,6 +606,162 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
 }
 
 /**
+ * Functional tests for the locale_plural_format function.
+ */
+class LocalePluralFormatTest extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Plural format',
+      'description' => 'Tests locale_plural_format function.',
+      'group' => 'Locale',
+    );
+  }
+
+  /**
+   * A user able to create languages and import translations.
+   */
+  protected $admin_user = NULL;
+
+  function setUp() {
+    parent::setUp('locale', 'locale_test');
+
+    $this->admin_user = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+  /**
+   * Test locale_get_plural.
+   *
+   * - We're not testing the formula's but the fact that we do get different
+   *   but correct answers for different languages and counts.
+   * - We're not (yet) testing non-enabled languages nor languages without
+   *   formula's.
+   */
+  function testGetPluralFormat() {
+    // Add some languages
+    locale_add_language('fr');
+    locale_add_language('hr');
+
+    // Import some .po files with formula's
+    // (could be replaced by 2 statements like:)
+    /*
+            db_update('languages')
+              ->fields(array(
+                'plurals' => $nplurals,
+                'formula' => $plural,
+              ))
+              ->condition('language', $lang)
+              ->execute();
+    */
+    $this->importPoFile($this->getPoFile(), array(
+      'langcode' => 'fr',
+    ));
+    $this->importPoFile($this->getPoFileWithContext(), array(
+      'langcode' => 'hr',
+    ));
+
+    // test locale_get_plural for english
+    $this->assertIdentical(locale_get_plural(1, 'en'), 0, t("Get plural format index for 'en' with count 1."));
+    $this->assertIdentical(locale_get_plural(0, 'en'), 1, t("Get plural format index for 'en' with count 0."));
+    $this->assertIdentical(locale_get_plural(5, 'en'), 1, t("Get plural format index for 'en' with count 5."));
+
+    // test locale_get_plural for french
+    $this->assertIdentical(locale_get_plural(1, 'fr'), 0, t("Get plural format index for 'fr' with count 1."));
+    $this->assertIdentical(locale_get_plural(0, 'fr'), 0, t("Get plural format index for 'fr' with count 0."));
+    $this->assertIdentical(locale_get_plural(5, 'fr'), 1, t("Get plural format index for 'fr' with count 5."));
+
+    // test locale_get_plural for hungarian
+    $this->assertIdentical(locale_get_plural( 1, 'hr'), 0, t("Get plural format index for 'hr' with count 1."));
+    $this->assertIdentical(locale_get_plural(21, 'hr'), 0, t("Get plural format index for 'hr' with count 21."));
+    $this->assertIdentical(locale_get_plural( 0, 'hr'), 2, t("Get plural format index for 'hr' with count 0."));
+    $this->assertIdentical(locale_get_plural( 2, 'hr'), 1, t("Get plural format index for 'hr' with count 2."));
+    $this->assertIdentical(locale_get_plural( 8, 'hr'), 2, t("Get plural format index for 'hr' with count 8."));
+  }
+
+  /**
+   * Helper function: import a standalone .po file in a given language.
+   *
+   * @param $contents
+   *   Contents of the .po file to import.
+   * @param $options
+   *   Additional options to pass to the translation import form.
+   */
+  function importPoFile($contents, array $options = array()) {
+    $name = tempnam('temporary://', "po_") . '.po';
+    file_put_contents($name, $contents);
+    $options['files[file]'] = $name;
+    $this->drupalPost('admin/config/regional/translate/import', $options, t('Import'));
+    drupal_unlink($name);
+  }
+
+  /**
+   * Helper function that returns a proper .po file.
+   */
+  function getPoFile() {
+    return <<< EOF
+msgid ""
+msgstr ""
+"Project-Id-Version: Drupal 7\\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=UTF-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\\n"
+
+msgid "One sheep"
+msgid_plural "@count sheep"
+msgstr[0] "un mouton"
+msgstr[1] "@count moutons"
+
+msgid "Monday"
+msgstr "lundi"
+
+msgid "Tuesday"
+msgstr "mardi"
+
+msgid "Wednesday"
+msgstr "mercredi"
+
+msgid "Thursday"
+msgstr "jeudi"
+
+msgid "Friday"
+msgstr "vendredi"
+
+msgid "Saturday"
+msgstr "samedi"
+
+msgid "Sunday"
+msgstr "dimanche"
+EOF;
+  }
+
+  /**
+   * Helper function that returns a .po file with context.
+   */
+  function getPoFileWithContext() {
+    // Croatian (code hr) is one the the languages that have a different
+    // form for the full name and the abbreviated name for the month May.
+    return <<< EOF
+msgid ""
+msgstr ""
+"Project-Id-Version: Drupal 7\\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=UTF-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\\n"
+
+msgctxt "Long month name"
+msgid "May"
+msgstr "Svibanj"
+
+msgid "May"
+msgstr "Svi."
+EOF;
+  }
+
+}
+
+/**
  * Functional tests for the import of translation files.
  */
 class LocaleImportFunctionalTest extends DrupalWebTestCase {
