Make I18n systems more robust against missing keys in pluralization data
Should make situations like #4468 less frequent
This commit is contained in:
parent
9d092c1b2f
commit
0cdfc7cfbd
3 changed files with 7 additions and 5 deletions
|
|
@ -12,6 +12,7 @@
|
|||
* Fix preview with more than one mention [#4450](https://github.com/diaspora/diaspora/issues/4450)
|
||||
* Fix size of images in the SPV [#4471](https://github.com/diaspora/diaspora/pull/4471)
|
||||
* Adjust 404 message description to not leak logged out users if a post exists or not [#4477](https://github.com/diaspora/diaspora/pull/4477)
|
||||
* Make I18n system more robust against missing keys in pluralization data
|
||||
|
||||
## Features
|
||||
* Add oEmbed content to the mobile view [#4343](https://github.com/diaspora/diaspora/pull/4353)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
translatedMessage,
|
||||
nextNamespace;
|
||||
|
||||
if(views && typeof views.count !== "undefined") {
|
||||
items.push(this.pluralizationKey(views.count));
|
||||
}
|
||||
|
||||
while(nextNamespace = items.shift()) {
|
||||
translatedMessage = (translatedMessage)
|
||||
? translatedMessage[nextNamespace]
|
||||
|
|
@ -30,10 +34,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(views && typeof views.count !== "undefined") {
|
||||
translatedMessage = translatedMessage[this.pluralizationKey(views.count)];
|
||||
}
|
||||
|
||||
return _.template(translatedMessage, views || {});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module I18n
|
|||
result = super(fallback, key, options)
|
||||
return result unless result.nil?
|
||||
rescue I18n::MissingInterpolationArgument
|
||||
rescue I18n::InvalidPluralizationData
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue