Currency Symbol in magento - php

I have created two Magento Store Views in two Different Languages:
English
Dutch
English (EURO) Currency symbol comes in proper manner like € 20.00 but for Dutch Language view it shows me like 20,00 EUR. I wants to setup by default symbol € for both views since the EURO is the same. How can i achieve it in Magento.

You can change your locale setting
here is example for English. For that you have to do Minor changes in your Language File. Following is the Directory Structure of File.
=> root/lib/Zend/Locale/Data/en.xml (For English Language)
=> around line 2611 you can see following code.
<currencyFormat>
<pattern>¤#,##0.00;(¤#,##0.00)</pattern>
</currencyFormat>
=> Now Change above code with Following code.
<currencyFormat>
<pattern>#,##0.00 ¤;(#,##0.00 ¤)</pattern>
</currencyFormat>
you can set it to for Dutch.

You can define currency symbol from admin.
Go to system->manage currency and select symbol.
Here you can define currency symbol.

For both store english and dutch select Default Config
system > configuration > general > currency setup > currency options >
change Base currency = Euro
default display currency = Euro
Allowed Currencies = Euro and US DOllar
only for dutch store admin-panel system > configuration
and select your dutch store.
After set your currency.
system > configuration > general > currency setup > currency options
Set this option
Default Display Currency = Euro
Allowed Currencies = Euro and US DOllar

You can change your locale setting
here is example for English. For that you have to do Minor changes in your Language File. >Following is the Directory Structure of File.
>=> root/lib/Zend/Locale/Data/en.xml (For English Language)
=> around line 2611 you can see following code.
> <currencyFormat>
> <pattern>¤#,##0.00;(¤#,##0.00)</pattern>
> </currencyFormat>
=> Now Change above code with Following code.
> <currencyFormat>
> <pattern>#,##0.00 ¤;(#,##0.00 ¤)</pattern>
> </currencyFormat>
you can set it to for Dutch.
To fix the comma form 1.000 to 1,000
add to the past post the following :
go to: => root/lib/Zend/Locale/Data/XX.xml (XX.xml For your Language)
for example : => root/lib/Zend/Locale/Data/en.xml (For English Language)
around line 2286 you can see following code :
<numbers>
<defaultNumberingSystem> xxx your Language xxx </defaultNumberingSystem>
<symbols>
<decimal>,</decimal>
<group>.</group>
to :
<numbers>
<defaultNumberingSystem> xxx your Language xxx </defaultNumberingSystem>
<symbols>
<decimal>.</decimal>
<group>,</group>
this wil change the comma form 1.000 to 1,000

You will have to change the file: /lib/Zend/Locale/Data/root.xml
Go to the row that contains <symbol>[Your currency]</symbol> and change [Your currency]
Ex: change <symbol>USD</symbol> to <symbol>XYZ</symbol>

Related

Is it correct I18n::setLocale('en_FR') in cakephp 4?

I'm working with i18n in my website with Cakephp 4.
My routes use languages with 2 characters (fr, en, it, etc.)
// Route For example
$builder
->connect(
'/{lang}/{controller}/{action}/*',
[]
)
->setPatterns([
'lang' => 'fr|en|it'
])
->setPersist(['lang']);
As the country is not defined, when I do :
echo __(
'Bonjour {0}, votre solde au {1,date} est de {2,number,currency}',
['Olivier', \Cake\I18n\FrozenTime::now(), 1354.37]
);
The currency is ¤ instead of €.
So I've set language with country FR in my AppController :
if($this->request->getParam('lang'))
I18n::setLocale($this->request->getParam('lang') . '_FR');
The aim is to have € whatever the language.
Thus, it generates fr_FR, en_FR, it_FR.
Is it correct to do that or is it ugly ?
If someone could enlighten me...
¤ (U+00A4) is the character used to denote an unspecified currency, this is the expected behavior when not supplying a region alongside the language.
Instead of using a specific region you could use the currency keyword to specify the currency independently:
// eg en#currency=EUR
$locale = "{$this->request->getParam('lang')}#currency=EUR";
I'm not sure though if the translate behavior will work properly with it, you might have to set the locale on the table instance manually so that it doesn't contain any keywords.
See also
ICU Documentation > Locales and Resources > The Locale Concept > Keywords
Cookbook > Database Access & ORM > Behaviors > Tree

Sentrifugo - PHP can't display Unicode (Vietnamese) correctly

I'm using Sentrifugo open source HRM software. When I insert Unicode text data, the page displays it properly, except for some tables like this.
For example, this website shows it incorrecty: Nguyá»�n Thá»� Hà Linh, but when I point at that to show the title or click View detail, the text displays it correctly: Nguyễn Thị Hà Linh.
The database also changes to utf8.
I appended two lines above in to application.ini.
I also use SET NAME UTF 8:
$mysqlPDO = new PDO('mysql:host='.SENTRIFUGO_HOST.';dbname='.SENTRIFUGO_DBNAME.'',SENTRIFUGO_USERNAME, SENTRIFUGO_PASSWORD,array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$mysqlPDO->exec("set names utf8");
All columns in every table are utf8.
Please see these images:
- Database
Column
Somewhere on web show well
Somewhere show symbol (like ASCII)

Set product status with magmi (product enabled/disbaled)

I used Value Replacer and Clumn Mapper to set product status (enabled/disabled) but i have no effect in my magento!
Here my settings. Somebody have the same problems?
CSV content is:
nr;rack;
10001-52;Yes;
10001-55;No;
To use magmi, first i need convert the data to this correct content:
sku;status;
10001-52;1;
10001-55;2;
I use this plugins settings to convert the data:
Column mapper
Mapped columns list:nr,rack
nr = sku
rack = status
Value Replacer
Replaced attributes: Yes,No
Yes=1
No=2
(For magento "product status" disabled or enabled)
Magmi settings
CSV separator is: ;
CSV Enclosure: i leave it blank
Multiselect value separator: ;
Thank you so much!
Tommy

City name, County name returning in other languages not in English

When i search using below FQ API :
https://api.foursquare.com/v2/venues/search?ll=19.346523,-99.191292&query=gimn&oauth_token=Z1NASAZ5IEUSDJAJG1VMQO5YX410DJXUKBKAHXN0FYIB15BQ&v=20150401
In browser we got the City name as "Mexico City".
But, when i used this API call in file_get_contents or curl, city name is returning as "Ciudad de México" in spanish language.
I need City name in English, Pls provide me the steps to fix this issue.
Thanks,
Suhanya.M
It's defaulting to Spanish, as it's the most popular for that locale. You can specify locale=en for English:
https://developer.foursquare.com/overview/versioning
Here's what the new link would look like; note the additional parameter at the very end:
https://api.foursquare.com/v2/venues/search?ll=19.346523,-99.191292&query=gimn&oauth_token=Z1NASAZ5IEUSDJAJG1VMQO5YX410DJXUKBKAHXN0FYIB15BQ&v=20150401&locale=en

Region name for an ISO 3166-1 alpha-2 country code

In a database we have ISO 3166-1 alpha-2 country codes, e.g. GB for United Kingdom and AR for Argentina. Today we keep a database table with one column for these country codes and one for corresponding English country names.
We work in PHP (5.4.x) which has the intl extenion (wrapper for ICU library) so I thought I'd like to fetch the country names from this source which makes the application more maintainable and easier to internationalize as I easily can fetch country names in German, French or whatever we want in the future.
Locale::getDisplayRegion ( string $locale [, string $in_locale ] ) provides a region name from a locale.
E.g.
php > echo Locale::getDisplayRegion('en-US', 'de') . PHP_EOL;
Vereinigte Staaten
php > echo Locale::getDisplayRegion('en-US', 'en') . PHP_EOL;
United States
The problem is that I do not have the language code, only the country code, so I'm not sure how to build up a proper locale.
It seems like I can get the region names by just prefixing with 'en_' for English, e.g
php > echo Locale::getDisplayRegion('en-CH', 'en') . PHP_EOL;
Switzerland
php > echo Locale::getDisplayRegion('en-CN', 'en') . PHP_EOL;
China
php > echo Locale::getDisplayRegion('en-AR', 'en') . PHP_EOL;
Argentina
However, this feels more like a hack and I'm not sure I really can rely on that?
I was thinking if I could somehow compose a locale using the country code (region / territory depending on terminology) and any of the valid languages for the country, but it appears it doesn't work as far as I've found at least:
php > echo Locale::composeLocale( array('region' => 'CN') ) . PHP_EOL;
php >
Any recommendations on how to go about this?
I do not want to maintain my own database of country names or simply use an external PHP library for it when there's a built-in extension which seem to be a good source (ICU) already.
Thanks a lot in advance!
use und (unknown language). So 'und_' . 'AR' etc.

Categories