Ah, just one addition: No you would not require to switch the parameter, 
because the parameter would remain the same - in the property files it would 
look like this:

Propertyfile for en_GB:

maxvalue=200

Propertyfile for de_DE:

maxvalue=100

in the code you would receive the max value based on the current locale 
"getString("maxvalue")"

kind regards

Tobias

> Am 27.01.2015 um 07:38 schrieb Christian Schröter 
> <[email protected]>:
> 
> 
> Thank you Tobias,
> 
> but this will unfortunately just solve the problem having the same validator 
> with different parameters. To add a market specific validator, I still would 
> need to switch case the locale.
> 
> Any other ideas?
> 
>> Hi,
>> 
>> you could place the values in the locale file and parse them.
>> 
>> Integer.parseInt(getString("maxvalue"));
>> 
>> kind regards
>> 
>> Tobias
>> 
>>> Am 26.01.2015 um 11:01 schrieb Christian Schröter 
>>> <[email protected]>:
>>> 
>>> Hey,
>>> 
>>> I would be interested to know if there is a builtin mechanism to add 
>>> specific validators for a certain locale.
>>> 
>>> For example:
>>> 
>>> de_DE -> StringValidator.maximumLength(100)
>>> en_GB -> StringValidator.maximumLength(200);
>>> en_US -> StringValidator.maximumLength(200);
>>> & AnotherValidatorOnlyForUS();
>>> 
>>> My current solution is a switch-case over the locale to add the correct 
>>> validators.
>>> With more locales and more validators this solution feels kind of sloppy.
>>> 
>>> What does your solution looks like?
>>> 
>>> 
>>> Cheers,
>>> Chris
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to