Page MenuHomePhabricator

Incorrect implementation of Bulgarian formatNum()
Closed, ResolvedPublic

Description

Author: b.manolov

Description:
formatNum() was incorrect implemented: First all dots were replaced by commas,
and then all commas - by spaces.

The new implementation uses code taken from LanguageEt::commafy().


Version: 1.6.x
Severity: normal

Details

Reference
bz3408

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:49 PM
bzimport set Reference to bz3408.

b.manolov wrote:

New implementation of LanguageBg::formatNum()

attachment LanguageBg.patch ignored as obsolete

avarab wrote:

(In reply to comment #1)

Created an attachment (id=866) [edit]
New implementation of LanguageBg::formatNum()

Am I right that you want to format numbers as 10 000,5 only if they are >=
10000 otherwise format them as 1000,5? First of all you can't use &nbsp (see bug

  1. and second why don't you just call commafy() instead of duplicating the

code to add something every three digits?

b.manolov wrote:

(In reply to comment #2)

Am I right that you want to format numbers as 10 000,5 only if they are >=
10000 otherwise format them as 1000,5? First of all you can't use &nbsp (see bug

  1. and second why don't you just call commafy() instead of duplicating the

code to add something every three digits?

Yes, you are right about grouping if >= 10000.
And yes, I could call commafy():

if ( preg_match('/^\d{5}/', $number) ) {

		$number = $this->commafy($number);

}
return str_replace(array(',', '.'), array(' ', ','), $number);

Is bug 2749 fixed or no?

zigger wrote:

(Please add wikibugs-l@wikipedia.org to the CC list when assigning bugs.)

b.manolov wrote:

Language::commafy(), w/o "&"

LanguageBg::formatNum() now uses Language::commafy(). The HTML entity " "
is replaced by hex code. I've used some code from LanguageCs class
($digitTransTable array).

Attached: