Git Product home page Git Product logo

Comments (5)

themisir avatar themisir commented on July 21, 2024 1

Fixed in v0.1.6-next. I published as prerelease since there's some breaking changes.

from form-validator.

themisir avatar themisir commented on July 21, 2024

I'm thinking about using Map<String, String> for storing i18n messages rather than classes.

final localeData = <String, String>{
  'min_length': 'Must be at least {min} characters',
};

FormValidator.addLocale('en', localeData);

addLocale will merge new locale data with previous data, so you can append custom validation messages too.

FormValidator.addLocale('en', {
  'custom_validation': 'lorem ipsum dolor ...',
});

What do you think about that?

Some other methods would be added too, for example addMessage to add single message in multiple languages:

FormValidator.addMessage('custom_validation', {
  'en': '...',
  'fr': '...',
  ...
});

from form-validator.

monisnap-julien avatar monisnap-julien commented on July 21, 2024

I think it would be a great solution for this problem 👍

from form-validator.

monisnap-julien avatar monisnap-julien commented on July 21, 2024

Hello ! I've just tried this new version but i'm getting this error :

Unsupported operation: Cannot set value in unmodifiable Map

When the exception was thrown, this was the stack
#0      _ImmutableMap.[]=                              (dart:core-patch/immutable_map.dart:74:5)
#1      LocalizationImpl.addMessage             package:form_validator/src/localization_impl.dart:25

I couldn't found where this come from but maybe the Localdata is only accessible via "get" only somewhere.

from form-validator.

themisir avatar themisir commented on July 21, 2024

Hello ! I've just tried this new version but i'm getting this error :

Unsupported operation: Cannot set value in unmodifiable Map

When the exception was thrown, this was the stack
#0      _ImmutableMap.[]=                              (dart:core-patch/immutable_map.dart:74:5)
#1      LocalizationImpl.addMessage             package:form_validator/src/localization_impl.dart:25

I couldn't found where this come from but maybe the Localdata is only accessible via "get" only somewhere.

Thanks for reporting. I think const <String, String>{ ... } maps become read-only maps.

from form-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.