Page MenuHomePhabricator

EXIF data lacking localization
Closed, ResolvedPublic

Description

Numbers in the EXIF data block on image description pages are always rendered in English format instead of the format of the user's preferred language.

The relevant code seems to be function formatNum on line 1082 of Exif.php, which is

01082 function formatNum( $num ) {
01083 $m = array();
01084 if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) )
01085 return $m[2] != 0 ? $m[1] / $m[2] : $num;
01086 else
01087 return $num;
01088 }

It rather should be

01082 function formatNum( $num ) {
01083 global $wgLang;
01084 $m = array();
01085 if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) )
01086 return $wgLang->formatNum( $m[2] != 0 ? $m[1] / $m[2] : $num );
01087 else
01088 return $wgLang->formatNum( $num );
01089 }

Thanks


Version: unspecified
Severity: enhancement

Details

Reference
bz18389

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:31 PM
bzimport set Reference to bz18389.
bzimport added a subscriber: Unknown Object (MLST).
Slomox created this task.Apr 7 2009, 3:36 PM

Please provide a patch for SVN trunk.

A patch? I'm not a MediaWiki programmer. I don't know how a patch has to look like. I provided the code that fixed the issue for my local installation above.

ahmad.m.sherif wrote:

patch

A patch per comment#0. The patch however doesn't work for "Exif version" field and the fraction (x/xxx) in "Exposure time" field.

Attached:

Applied in r50689. Thanks.

brion added a comment.May 18 2009, 8:21 PM

r50748 fixes the exposure time fraction.