Page MenuHomePhabricator

EXIF data lacking localization
Closed, ResolvedPublic


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 }


Version: unspecified
Severity: enhancement



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).

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:


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


r50748 fixes the exposure time fraction.