Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve localization of values in forms #587

Open
neos-bot opened this issue Aug 13, 2015 · 1 comment
Open

Improve localization of values in forms #587

neos-bot opened this issue Aug 13, 2015 · 1 comment

Comments

@neos-bot
Copy link
Contributor

Jira issue originally created by user lubitz:

It is quite complicated at the moment to work with localized values in forms.

You must format the value by your own and set as value. So you can't use the "property" attribute and for example. Maybe an additional attribute for localization could help, but better were a general handling of localizations in the backgroud for some cases (e.g. forms)

<f:form.textfield name="course[startDate]" value="{course.startDate -> f:format.date(forceLocale:true, localeFormatType:'date')}" id="startDate" type="date" />
# instead of 
<f:form.textfield property="startDate" id="startDate" type="date" />

Also you have to create initialize actions to change the options for this property for every - value receiving - action (create/update), so the validator will except your formated value.

public function initializeCreateAction() {
  $pmc = $this->arguments['course']->getPropertyMappingConfiguration();
  $pmc->forProperty('startDate')
    ->setTypeConverterOption('TYPO3\Flow\Property\TypeConverter\DateTimeConverter',
        \TYPO3\Flow\Property\TypeConverter
        DateTimeConverter::CONFIGURATION*DATE*FORMAT,
        'd.m.Y');
}

At the end I think the currently set up locale could be used in backgroud and operate as default, as long as there is no locale explicit set to overwrite the default locale.

In my case above it's just the date, but I guess the localized output of currencies and numbers will also have the same issues.

Jira-URL: https://jira.neos.io/browse/FLOW-368

@neos-bot
Copy link
Contributor Author

Comment created by @albe:

There are indeed some inconsistencies with locale usage in flow currently:

  • viewhelper don't use locale at all, unless the forceLocale attribute is specified (boolean TRUE = use current locale)
  • validators use the current locale by default, unless specifie otherwise in validator options
  • property mapping needs explicit configuration to make use of locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants