Announcement

  •  » Extensions
  •  » [resolved] SmartAlbums not work with locale

#1 2014-02-10 22:26:21

JanisV
Member
2013-09-25
85

[resolved] SmartAlbums not work with locale

Hi!

I use non-default locale (ru_RU.UTF-8) for workaround [Forum, topic 22468] Cyrillic in galleries names and sync.

And this give me a JavaScript error:

Code:

SyntaxError: missing : after property id
  min: 0,33,

Problem at admin/template/album.tpl:178

Code:

        min: {$dimensions.bounds.min_ratio},
        max: {$dimensions.bounds.max_ratio},

.
With Russian locale float numbers use comma as delimeter. Possible workaround is replace admin/album.php:290

Code:

    $ratios[] = floor($row['width'] / $row['height'] * 100) / 100;

with

Code:

    $ratios[] = round(floor($row['width'] / $row['height'] * 100) / 100);

Last edited by JanisV (2014-02-10 22:34:30)

Offline

 

#2 2014-02-10 22:33:34

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [resolved] SmartAlbums not work with locale

Hello

You should not use LC_ALL for the first parameter, it modify the representation of all doubles and you will run in many troubles (I'm sure you have the same error on the Batch Manager)

try LC_ALL&~LC_NUMERIC

edit: images ratio information without decimals is totally useless at least for values bellow 1, round is not a correct fix

Offline

 

#3 2014-02-10 22:53:03

JanisV
Member
2013-09-25
85

Re: [resolved] SmartAlbums not work with locale

mistic100 wrote:

Hello

You should not use LC_ALL for the first parameter, it modify the representation of all doubles and you will run in many troubles (I'm sure you have the same error on the Batch Manager)

try LC_ALL&~LC_NUMERIC

edit: images ratio information without decimals is totally useless at least for values bellow 1, round is not a correct fix

Thanx for quick reply!

LC_ALL&~LC_NUMERIC don't help, but next two lines work good:

setlocale(LC_ALL, 'ru_RU.UTF-8');
setlocale(LC_NUMERIC, 'C');

Last edited by JanisV (2014-02-10 22:53:44)

Offline

 
  •  » Extensions
  •  » [resolved] SmartAlbums not work with locale

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact