Page MenuHomePhabricator

Review and deploy FormatNum extension
Closed, DeclinedPublic

Description

The FormatNum extension ([[mw:Extension:FormatNum]]) is a parser function extension adding new number formatting capabilities.

Two projects, sl.wikip and fa.wikip have requested it.

This extension should be reviewed and considered for deployment.


Version: wmf-deployment
Severity: minor
URL: https://www.mediawiki.org/wiki/Extension:FormatNum

Details

Reference
bz40422

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:04 AM
bzimport set Reference to bz40422.
bzimport added a subscriber: Unknown Object (MLST).

sumanah wrote:

The procedure at https://www.mediawiki.org/wiki/Writing_an_extension_for_deployment says that, since FormatNum is a user-facing feature, it needs a design review https://www.mediawiki.org/wiki/Writing_an_extension_for_deployment . Can Dereckson or DaSch start getting that design review?

Thanks!

Why did slwiki and fawiki request it? Doesn't the core {{formatnum: }} work for them? (yes, there's a name clash, quite bad for the proposed extension)
If the number format configured for their language is wrong, it should be fixed in the language files, not workarounded with an extension.

I don't know for fa., so I asked them recopying your question in this bug.

For sl., it's because they want to be able to format number with comma as thousand separator.

Note there could be other side reasons, as the bug 40186 description says: "Unlike English, our language uses commas as decimal mark, which is the main reason we need the extension."

For sl., it's because they want to be able to format number with comma as
thousand separator.

Note there could be other side reasons, as the bug 40186 description says:
"Unlike English, our language uses commas as decimal mark, which is the main
reason we need the extension."

Then the change should go into the message file.
Something like separatorTransformTable = array( ',' => '.', '.' => ',' ); [assuming they use . thousands mark ]
Wrong bug #?

as Dereckson said for fa.wiki we want to be able to format number with comma as
thousand separator as an additional option

Platonides, with this new information, could you take in charge the design review and determines the cost/benefits to allow this extension or extend the core {{formatnum}}?

it will be useful in wikis that they need local number. it is used in many templates that they works with year numbers
I mentioned the details in bug 35753
In my opinion it could be extending {{formatnum}} because many wikis (Specially Asian languages) needs this option.According to maintenance it will be better to have similar wikis

with n variable it could be like {{formatnum:2010|n}}=> ۲۰۱۰

Would this be something that would be a good fit for a Lua module?

Why did slwiki and fawiki request it? Doesn't the core {{formatnum: }} work for them? (yes, there's a name clash, quite bad for the proposed extension)
If the number format configured for their language is wrong, it should be fixed in the language files, not workarounded with an extension.

New use case from Wikimedia CA: to be able to format numbers in French or English.

For the record, the sl.wikipedia.org request (T42386) and fa.wikipedia.org request (T34311) were closed as invalid/declined because core {{formatnum:}} suffices for them after all.

As such, the original extension review/deployment request no longer stands, given that it was for slwiki/fawiki.

I suppose we can re-consider it for WMCA, but I do agree with Greg that most likely a Lua module will suffice - depending on what use case it is needed for and how wide of a range of languages and formats it needs.

Note: Security-wise the extension is not problematic. I'm not so sure it's the right way to fix the problem, though. It's probably better to expand (merge into?) core {{formatnum}}.

To improve the parser function in the core looks a better approach to me.

Currently, {{formatnum:}} is for one type of formating: English format, and it doesn't work on multilangual wikis.
With the extension, you can choose decimals and thousands separator.

See : https://commons.wikimedia.org/wiki/User:Benoit_Rochon/Formatnum

Better to improve the parser as {{ FORMATNUM: 4253791 | FR }} ?

Yes, it would also be welcome on beta.wikimedia.org

Psychoslave added a comment.

Yes, it would also be welcome on beta.wikimedia.org

On what?

Sorry, I mean beta.wikiversity.org

Currently, {{formatnum:}} is for one type of formating: English format, and it doesn't work on multilangual wikis.

It does support many languages, and it follows the language of the page.

With the extension, you can choose decimals and thousands separator.

True

Better to improve the parser as {{ FORMATNUM: 4253791 | FR }} ?

This has already been declined in favor of having a more general mechanism to define language of a page, or some part of a page.

On Wikimedia Canada, do you use pages with bilingual content en/fr, or on
different pages?

Currently, {{formatnum:}} is for one type of formating: English format, and it doesn't work on multilangual wikis.

It does support many languages, and it follows the language of the page.

Hello Niklas. Unfortunately, this is not what I'm experiencing : https://commons.wikimedia.org/wiki/User:Benoit_Rochon/Formatnum

On Wikimedia Canada, do you use pages with bilingual content en/fr, or on different pages?

Both can be seen.

Note: Security-wise the extension is not problematic.

Says who? :) It's been a while since I looked at this task, but a security review is required for all extensions before being deployed to Beta Cluster and then production (any wiki).

I see the conversation might be back at "implement in core", which is fine.

That was said by yours truly, :)

Of course, you are free not to consider my statements trustful and expect more people to look at it. The more eyes the better. I wasn't even attempting to provide a formal assessment (the wiki procedure seems quite long, plus I don't even know how useful that would be), just a handy note for everyone involved that there are no security dragons on this extension. ☺

Currently, {{formatnum:}} is for one type of formating: English format, and it doesn't work on multilangual wikis.

It does support many languages, and it follows the language of the page.

Hello Niklas. Unfortunately, this is not what I'm experiencing : https://commons.wikimedia.org/wiki/User:Benoit_Rochon/Formatnum

Interface language is not the same thing as page content language.

Currently, {{formatnum:}} is for one type of formating: English format, and it doesn't work on multilangual wikis.

It does support many languages, and it follows the language of the page.

Hello Niklas. Unfortunately, this is not what I'm experiencing : https://commons.wikimedia.org/wiki/User:Benoit_Rochon/Formatnum

Interface language is not the same thing as page content language.

Sure, but still, it's not working in multilangual Wikis.
So my humble opinion is {{formatnum:}} should be more flexible.
For instance :

{{LangSwitch | en={{FORMATNUM:{{{bytes|}}} }} | fr={{FORMATNUM:{{{bytes|}}} }} }}

or

{{FORMATNUM:4321 | fr }}

Otherwise, maybe we should consider Extension:FormatNum :

{{LangSwitch | en={{#formatnum: {{{bytes|}}}|2|.|,}} | fr={{#formatnum: {{{#ytes|}}}|2|,|_}} }}

Benoit

On Wikimedia Canada, do you use pages with bilingual content en/fr, or on different pages?

Both can be seen.

And will you have difficulties making every page use a single language? If you manage to use a single language in each page's content, then T69223 will solve all your issues.

On Wikimedia Canada, do you use pages with bilingual content en/fr, or on different pages?

Both can be seen.

And will you have difficulties making every page use a single language? If you manage to use a single language in each page's content, then T69223 will solve all your issues.

I love Extension:Translate, don't get me wrong, but not adapted for small wiki like ours. The only thing that is missing is the possibility of forcing {{FORMATNUM:}} to display in French / English when needed.

Sorry, misunderstood. WMCA pages are bilingual, we use to seperate both languages, but it's heading more and more to merge en/fr.

but it's heading more and more to merge en/fr

And why?

For many years, I tried few different ways to manage both official languages in Canada within the same Wiki, not easy, most tools are having their gaps.

Now when it's merged, it's easier to manage, since most activity is from Francophones, templates that are flagging when there's no English version and vice versa, etc. I'm heading using more {{LangSwitch}} within the same page. When I'm asking our members to write a report, they want simplified forms, not necessarely writing bilingual.

In a nutshell, the only thing that is missing at this point, is a more flexible {{FORMATNUM}}.

I know it should not have taken 2+ years to bring the 2014 fix of T11360 to your wiki, but most of the work for T69223 is now done so I'd recommend you to wait a little more and reassess your choices when Special:PageLanguage is enabled on your wiki.

Aklapper lowered the priority of this task from Medium to Low.May 10 2020, 8:04 AM

FormatNum has been archived. This request could be switched to Extension:NumberFormat, or just close this one and open a new one.

Jdforrester-WMF subscribed.

I'll mark this as Declined; if there's still a need, a new task can be filed.