Commit 324341dc authored by Rich Trott's avatar Rich Trott Committed by Richard Mansfield
Browse files

Make untranslated Pieforms strings fall back to default language (en.utf8) (See bug #638525)

parent 9b3beda9
......@@ -192,7 +192,8 @@ class Pieform {/*{{{*/
}
// Assign defaults for the form
$this->data = array_merge(self::get_pieform_defaults(), $formconfig, $data);
$this->defaults = self::get_pieform_defaults();
$this->data = array_merge($this->defaults, $formconfig, $data);
// Set the method - only get/post allowed
$this->data['method'] = strtolower($this->data['method']);
......@@ -1148,7 +1149,7 @@ EOF;
/**
* Return an internationalised string based on the passed input key
*
* Returns english by default.
* Returns English by default.
*
* @param string $plugin The type of plugin (element, renderer, rule)
* @param string $pluginname The name of the plugin to get the language
......@@ -1189,6 +1190,10 @@ EOF;
if (isset($strings[$this->data['language']][$key])) {
return $strings[$this->data['language']][$key];
}
// If all else fails, try to get the string in the default language.
if (isset($strings[$this->defaults['language']][$key])) {
return $strings[$this->defaults['language']][$key];
}
return '[[' . $key . '/' . $this->data['language'] . ']]';
}
......
......@@ -48,9 +48,6 @@ function pieform_rule_before_i18n() {/*{{{*/
'en.utf8' => array(
'before' => 'This can not be after the field "%s"'
),
'en_US.utf8' => array(
'before' => 'This can not be after the field "%s"'
),
'de.utf8' => array(
'before' => 'Dies kann nicht nach dem Feld "%s" sein'
),
......
......@@ -47,9 +47,6 @@ function pieform_rule_email_i18n() {/*{{{*/
'en.utf8' => array(
'email' => 'E-mail address is invalid'
),
'en_US.utf8' => array(
'email' => 'E-mail address is invalid'
),
'de.utf8' => array(
'email' => 'Die E-Mail Addresse ist ungültig'
),
......
......@@ -44,13 +44,10 @@ function pieform_rule_integer_i18n() {/*{{{*/
'en.utf8' => array(
'integer' => 'The field must be an integer'
),
'en_US.utf8' => array(
'integer' => 'The field must be an integer'
),
'de.utf8' => array(
'de.utf8' => array(
'integer' => 'Das Feld muss eine Zahl sein'
),
'fr.utf8' => array(
'fr.utf8' => array(
'integer' => 'Ce champ doit être un nombre entier'
),
'ja.utf8' => array(
......
......@@ -44,13 +44,10 @@ function pieform_rule_maxlength_i18n() {/*{{{*/
'en.utf8' => array(
'maxlength' => 'This field must be at most %d characters long'
),
'en_US.utf8' => array(
'maxlength' => 'This field must be at most %d characters long'
),
'de.utf8' => array(
'de.utf8' => array(
'maxlength' => 'Das Feld darf höchstens %d Zeichen lang sein'
),
'fr.utf8' => array(
'fr.utf8' => array(
'maxlength' => 'Ce champ ne peut pas contenir plus de %d signes'
),
'ja.utf8' => array(
......
......@@ -44,9 +44,6 @@ function pieform_rule_maxvalue_i18n() {/*{{{*/
'en.utf8' => array(
'maxvalue' => 'This value can not be larger than %d'
),
'en_US.utf8' => array(
'maxvalue' => 'This value can not be larger than %d'
),
'de.utf8' => array(
'maxvalue' => 'Dieser Wert kann nicht größer als %d sein'
),
......
......@@ -44,9 +44,6 @@ function pieform_rule_minlength_i18n() {/*{{{*/
'en.utf8' => array(
'minlength' => 'This field must be at least %d characters long',
),
'en_US.utf8' => array(
'minlength' => 'This field must be at least %d characters long',
),
'de.utf8' => array(
'minlength' => 'Das Feld muss zumindest %d Zeichen lang sein',
),
......
......@@ -44,9 +44,6 @@ function pieform_rule_minvalue_i18n() {/*{{{*/
'en.utf8' => array(
'minvalue' => 'This value can not be smaller than %d'
),
'en_US.utf8' => array(
'minvalue' => 'This value can not be smaller than %d'
),
'de.utf8' => array(
'minvalue' => 'Dieser Wert kann nicht kleiner als %d sein'
),
......
......@@ -45,9 +45,6 @@ function pieform_rule_regex_i18n() {/*{{{*/
'en.utf8' => array(
'regex' => 'This field is not in valid form'
),
'en_US.utf8' => array(
'regex' => 'This field is not in valid form'
),
'de.utf8' => array(
'regex' => 'Das Feld hat keine zulässige Form'
),
......
......@@ -44,9 +44,6 @@ function pieform_rule_required_i18n() {/*{{{*/
'en.utf8' => array(
'required' => 'This field is required'
),
'en_US.utf8' => array(
'required' => 'This field is required'
),
'de.utf8' => array(
'required' => 'Das Feld ist erforderlich'
),
......
......@@ -52,9 +52,6 @@ function pieform_rule_validateoptions_i18n() {/*{{{*/
'en.utf8' => array(
'validateoptions' => 'The option "%s" is invalid'
),
'en_US.utf8' => array(
'validateoptions' => 'The option "%s" is invalid'
),
'de.utf8' => array(
'validateoptions' => 'Die Option "%s" ist ungültig'
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment