How can we improve Breeze.js?

Create function to translate error messages

it would be possible to include a function to breeze similar to the included in knockout-validation to translate error messages:

//quick function to override rule messages
ko.validation.localize = function (msgTranslations) {

var msg, rule;

//loop the properties in the object and assign the msg to the rule
for (rule in msgTranslations) {
if (ko.validation.rules.hasOwnProperty(rule)) {
ko.validation.rules[rule].message = msgTranslations[rule];
}
}
};

Related to: http://stackoverflow.com/questions/14316454/translate-breeze-validation-messages

27 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Julian YusteJulian Yuste shared this idea  ·   ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • PhoscurPhoscur commented  · 

        Please allow runtime localization changes in breeze for both knockout and angular!

      • PhoscurPhoscur commented  · 

        I can change language at runtime with angular-translate, the messages can only be set at configuration time.
        Mapping the validation messages to translation identifieres did not work as zValidationDirectiveTemplates do not get revaluated by angular.
        so I can't use this template <span class="invalid">{{"%error%" | translate}}</span>

      Feedback and Knowledge Base