Forcing reloading "currencies" tab in db (after editing CAD for CA_FR)

Hi,

In the current v5 release the FR_CA monetary numbers display syntax when the currency is set to CAD is not correct: it is “$1,000.00$” when it should be “1 000,00 $” (space thousand separator, comma decimal separator, dollar sign on the right preceded by a space). It may be interesting in a futur eversion to not only consider the country for currency formats, but also the language being used within the country: for Canada, at least, writing financial amounts in English is not the same as writing them in French.

More info here:
Canadian dollar (symbol) (Linguistic recommendation from the Translation Bureau) - Search for entries starting with C - Writing Tips - TERMIUM Plus® - Translation Bureau

Anyway, I successfully edited the “currencies” tab in the database with the proper French Canadian settings, but I can’t get Invoice Ninja to fetch this particular info in the database. I tried ?clear_cache=true in the URL, and I also flushed my browser cache and my CDN cache, but it did nothing. I then went back to the database and tried creating a test currency, and then I flushed all caches - still, the test currency does not show up.

What may I be doing wrong? Thanks in advance.

Hi,

If you click refresh data on Settings > Device Settings the app should reload the static data from the server.

@david we may want to update the static settings.

Thanks for the suggestion Hillel but it still doesn’t seem to work. Just to make sure I followed every step, here is a screenshot of the tweaked entries for CAD in phpMyadmin:

Then here is the “Refresh Data” button that shows it’s been activated seconds ago:

refresh

And then the URL with the cache clearing string:

dotcom

And here are my currency and language settings after refreshing the page and reselecting the options:

settings

Still no difference! Nothing has changed elsewhere either, such as the dashboard:

dashboard

:grimacing:

You shouldn’t have index.php in the URL but I don’t think it’s related.

@david any thoughts?

About index.php being shown I remember reading several other posts where you tell people to make sure that mod_rewrite is activated on the server for this to not happen. I checked my phpinfo.php file and this mod was not listed, so I contacted my host and they told me that it is indeed activated as it is needed for CPanel, but they hide it so users do not mess with the setting.

So all in all I don’t know either why index.php is showing up in the URL, it’s been there on all installs I’ve done so far (I reinstalled a few times to try to fix some glitches). I used Softaculous installer, if that changes anything.

try

/update?secret=

That did the trick @david !! Thanks a lot!

updatesecret

Glad to hear it’s working!

You may be able to remove it by changing the APP_URL value in the .env file.

You shouldn’t have index.php in the URL but I don’t think it’s related.

You may be able to remove it by changing the APP_URL value in the .env file.

Hello @hillel, about the the index.php showing the values looked correct in my .env file, but I found out that the culprit behind the wonky URLs is probably Softaculous, as its install process adds a bunch of rules to .htaccess that I have tried in vain to debug (I’m not really an Apache guru), so I tried simply doing a manual install in a subdomain and it works beautifully with the default .htaccess file, no more /public/index.php in the URL, yay!

However I get /#/ in the URL now, and I get it too when on your public v5 test page, is this normal?

Yes, that’s normal.

I believe it’s added by the framework we use to support the back button.

Hi @david ,

I was trying to troubleshoot various issues with my install and I ended up doing a fresh install on a new subdomain, to which I linked my previous database.

Well, my currencies edit got reset and I can’t get it to update anymore. Both ?clear_cache=true and /update?secret= make no difference anymore. I also tried to run php artisan optimize, but to no avail.

Is there any other way you might know to force a reloading of the currencies table to the interface?

By the way, would it possible to please support eventually the FR localization in Canada? As noted previously in this thread, in Canada the way to display monetary values is different whether the amounts are displayed in English or in French. For instance:

One thousand dollars in CA_EN = $1,000.00 → This is the only way IN works for now
One thousand dollars in CA_FR = 1 000,00 $ → This is the way IN should display monetary values for French Canadian speakers, ideally.

Thanks!

Update: I managed to make my changes to the currencies work reliably on a fresh install by linking it to a database already populated with the correct values. No other solution seems to work anymore to force the update of the currencies… Somehow the app builds something on the first run by checking the database and then it’s pretty much set there.

As for hoping eventually for a “real” fix, should I report this on Github, or was this added to some list of stuff to fix somewhere? I know it’s not a huge issue for your international audience, but it still happens to potentially affect 8 million people in Quebec, Canada for which it makes Invoice Ninja unusable out of the box without “dirty” tricks, so…

@hillel @david

@hillel

It looks like the fix here is to implement a new currency CAD_FR ?

It looks like the fix here is to implement a new currency CAD_FR ?

That would certainly work for me and other French Canadians, I guess. :slight_smile:

As for giving you and authoritative example so you just don’t take what I say for granted, I could not find any in English, but I know that if you set Windows to Canadian French regional settings, the monetary values are right by default (note: you can discard the negative values between parentheses, that would just be a pain to implement. A minus sign works fine for that). Here is a screenshot (in French, sorry):

@charles

Thanks, i can certainly see that the format is different.

1 Like

I must add, if you add a new currency, could you make it so it would still display publicly as CAD if so chosen in the settings (instead of the $ sign) ? Because that would still be the CAD currency, just displayed in a different manner. Maybe it could simply be labeled as “Canadian Dollar (fr-CA)”, and the other one “Canadian Dollar (en-CA)”?

image

@david if it may make the coding of currencies easier, it looks like all currencies and regional display formats are already built into javascript with the Intl.NumberFormat object:

const number = 2154.33;
console.log(new Intl.NumberFormat('fr-CA', { style: 'currency', currency: 'CAD' }).format(number));

result: "2 154,33 $ CA"

Maybe something could be implemented instead of relying on database currency entries? Just a thought.

Hi @charles

Thanks, I think the solution for our platform is to make the additional currency. Can you advise the properties that are changed in the currency table?

@hillel Does this work for you?

1 Like

Sure! There you go, I copied the whole line from the database

(9, 'Canadian Dollar', ' $', '2', ' ', ',', 'CAD', 1, 1.000000),

So:

  • Symbol: dollar sign with a space before ( $)
  • Swap currency symbol set to 1
  • Thousand separator: space ( )
  • Decimal separator: comma (,)

$1234.56 → 1 234,56 $

Thanks!