GNOME Bugzilla – Bug 556633
Bad accounting formats when the currency symbol follows the amount
Last modified: 2018-05-22 13:01:53 UTC
I used the icon (not the menu) to format a number like 1232,45 € (german localized gnome) in a selected cell but it looked like this: 1234,45 € 123,23 € .... but it should look like this: 1234,45 € 123,23 € I did'nt find this in the reported bugs (I searched "currency") Thank you very much for gnumeric.
This is locale specific and seems to relate to the currency symbol following the value. (So it is not visible in C.) I can confirm and replicate with both 1.8.3 and current svn.
The format we are applying is obtained from goffice via go_format_new_from_XL (go_format_builtins[GO_FORMAT_ACCOUNTING][2]) so we could send this bug report to them.
Okay in goffice in the file goffice/utils/formats.c in the function go_currency_date_format_init we have: if (precedes) { post_rep = post = (char *)""; pre_rep = (char *)"* "; pre = g_strconcat ("\"", curr, (space_sep ? "\" " : "\""), NULL); } else { pre_rep = pre = (char *)""; post_rep = (char *)"* "; post = g_strconcat ((space_sep ? " \"" : "\""), curr, "\"", NULL); } I am pretty sure that should be: if (precedes) { post_rep = post = (char *)""; pre_rep = (char *)"* "; pre = g_strconcat ("\"", curr, (space_sep ? "\" " : "\""), NULL); } else { pre_rep = pre = (char *)""; post_rep = (char *)""; post = g_strconcat ((space_sep ? " \"" : "\""), curr, "\"", NULL); } Since there is no point in pushing the numbers to the left.
Created attachment 120768 [details] [review] patch to fix the problem (excluding changelog entries)
When I switch XL to a German locale, it's currency button changes appearance and now sets the format _-* #.##0,00 €_-;-* #.##0,00 €_-;_-* "-"?? €_-;_-@_- In US locale it sets the format _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_) So neither the existing nor the proposed case appears to do the right thing, assuming MS' people are indeed following the right definition of "right thing".
If I read this right then in XL the accounting format in the German locale adds 2 dashes: one to the very right and one to the very left if compared to the proposed version. So the proposed version would be what one can do easily without major changes to current code. The other part can't be figured out from teh locale alone.
Mostly right. The minus on the right is invisible: _-
and for non-negative values the minus on the left luckily is also invisible. Next to "* " it so only has the effect to line things up correctly. somehow I have the feeling that this may just need to be a translatable string...
Looking at lconv all the information is there. The only problem is that a proper implementation should change go_locale_get_currency since we need more arguments added to it. go_locale_get_currency is public so this would imply an api change.
Created attachment 120821 [details] [review] suggested solution for this problem This patch only changes fmt_accounting[0] and [2]. Beforeapplying we would need to do the same for fmt_accounting[1] and [4] as well as all fmt_currency. The current formats are very north-america centric and assumes parentheses to indicate negative values.
That patch really needs a #define UNICODE_MINUS_S "\xe2\x88\x92" Apart from that, we can can the api of go_locale_get_currency if we need to in 0.7, but we might as well define a new function that provides more information. go_locale_get_currency could then be a simple wrapper.
Actually, why are we putting unicode minuses into format strings? It will not affect what we see on screen, and could break anyone what asks for the rendered string.
What do you mean with "it will not affect what we see on screen"? If we put ascii-hyphens in the format string then they will show as ascii hyphen on screen and that differs from the unicode minus that is used, for example, by the General format.
We know: US: _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_) German: _-* #.##0,00 €_-;-* #.##0,00 €_-;_-* "-"?? €_-;_-@_- We also need to know as what XL "translates" the following US strings: US: _($* #,##0_);_($* (#,##0);_($* \"-\"_);_(@_) US: _(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_) US: _(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_) While I have ideas what that could be, I have no way checking.
The code has been rewritten to use the new generators. That doesn't actually fix any of the observed problems here, but now it's only wrong in one place. I don't think localeconv's information is useful for us. For one thing, it says to use "-" for en_US -- we really want the parentheses. For another it clearly isn't debugged much -- look at ur_PK to see a very weird situation. C: p_sign_posn=127 sign= n_sign_posn=127 sign= aa_DJ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- aa_ER.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- aa_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- af_ZA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- am_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- an_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ar_AE.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_BH.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_DZ.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_EG.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ar_IQ.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_JO.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_KW.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_LB.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_LY.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_MA.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_OM.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_QA.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_SA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ar_SD.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_SY.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_TN.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- ar_YE.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- as_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ast_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- az_AZ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- be_BY.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- bg_BG.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- bn_BD.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- bn_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- br_FR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- bs_BA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- byn_ER.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ca_AD.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ca_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ca_FR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ca_IT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- cs_CZ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- cy_GB.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- da_DK.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- de_AT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- de_BE.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- de_CH.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- de_DE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- de_LU.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- el_CY.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- el_GR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_AU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_BE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_BW.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_CA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_DK.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_GB.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_HK.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- en_IE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_NZ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_PH.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- en_SG.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- en_US.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_ZA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- en_ZW.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_AR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_BO.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_CL.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_CO.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_CR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_DO.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_EC.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_GT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_HN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_MX.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_NI.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_PA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_PE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_PR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_PY.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_SV.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_US.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_UY.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- es_VE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- et_EE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- eu_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- fa_IR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- fi_FI.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- fo_FO.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- fr_BE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- fr_CA.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- fr_CH.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- fr_FR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- fr_LU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ga_IE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- gd_GB.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- gl_ES.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- gv_GB.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- he_IL.utf8: p_sign_posn=2 sign= n_sign_posn=2 sign=- hi_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- hr_HR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- hsb_DE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- hu_HU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- id_ID.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- is_IS.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- it_CH.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- it_IT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- iw_IL.utf8: p_sign_posn=2 sign= n_sign_posn=2 sign=- ja_JP.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- ka_GE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- kk_KZ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- kl_GL.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- ko_KR.utf8: p_sign_posn=1 sign= n_sign_posn=4 sign=- ku_TR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- kw_GB.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- lg_UG.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- lt_LT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- lv_LV.utf8: p_sign_posn=3 sign= n_sign_posn=3 sign=- mg_MG.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- mi_NZ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- mk_MK.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ml_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- mn_MN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- mr_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ms_MY.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- mt_MT.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- nb_NO.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- ne_NP.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- nl_BE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- nl_NL.utf8: p_sign_posn=1 sign= n_sign_posn=2 sign=- nn_NO.utf8: p_sign_posn=1 sign= n_sign_posn=3 sign=- no_NO.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- oc_FR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- om_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- om_KE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- pa_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- pl_PL.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- pt_BR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- pt_PT.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ro_RO.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ru_RU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ru_UA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- se_NO.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- sh_YU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sid_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sk_SK.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sl_SI.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- so_DJ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- so_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- so_KE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- so_SO.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sq_AL.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- st_ZA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sv_FI.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- sv_SE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ta_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- te_IN.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tg_TJ.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- th_TH.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- ti_ER.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ti_ET.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tig_ER.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tl_PH.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tr_CY.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tr_TR.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- tt_RU.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- uk_UA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- ur_PK.utf8: p_sign_posn=2 sign= n_sign_posn=1 sign=- wa_BE.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- xh_ZA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- yi_US.utf8: p_sign_posn=2 sign= n_sign_posn=2 sign=- zh_CN.utf8: p_sign_posn=4 sign= n_sign_posn=4 sign=- zh_HK.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- zh_SG.utf8: p_sign_posn=1 sign= n_sign_posn=0 sign=- zh_TW.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=- zu_ZA.utf8: p_sign_posn=1 sign= n_sign_posn=1 sign=-
Since we were talking about an API change here we should fix this while we can break API.
ur_PK.utf8: p_sign_posn=2 sign= n_sign_posn=1 sign=- since there is no sign used for positive values, the position of that no sign shouldn't really matter.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/goffice/issues/15.