mhirdes / go_maps_ext

Google Maps Extension for TYPO3
MIT License
21 stars 31 forks source link

Latitude/Longitude input field type 'double' has problems with german translation #13

Closed dachande closed 8 years ago

dachande commented 8 years ago

Currently the latitude- and logitude input field type in the TCA configuration for tx_gomapsext_domain_model_address is set to double.

'latitude' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:go_maps_ext/Resources/Private/Language/locallang_db.xlf:tx_gomapsext_domain_model_address.latitude',
    'config' => array(
        'type' => 'input',
        'size' => 30,
        'eval' => 'double,trim,required'
    ),
),

This leads to a JavaScript error when using the extension in a TYPO3 environment set to german because decimal separator is set to , (comma) instead of . (dot), so rendered JavaScript looks like this:

gme.addresses[0]  = {
    title: 'Address Title',
    latitude: 49,48254,     <-- wrong decimal separator
    longitude: 8,465676,  <-- wrong decimal separator
    address: 'Address String',
    ...
}

Instead you should use the f:format.number ViewHelper to force the decimal separator to a dot fixing that problem regardless of the TYPO3 environment:

go_maps_ext/Resources/Private/Partial/Map/Assign.html

latitude: {address.latitude -> f:format.number(decimals: '6', decimalSeparator: '.', thousandsSeparator: '')},
longitude: {address.longitude -> f:format.number(decimals: '6', decimalSeparator: '.', thousandsSeparator: '')},
dachande commented 8 years ago

I've just seen that you already have fixed that problem using another approach. Therefore I'm closing this issue again.