Question
Locale not working on my Ubuntu DigitalOcean Droplet
I developed a PHP shopping cart for a website that has world wide sales. Because of it's international traffic, I'm using setlocale() and localeconv() to display 'USD' next to all prices whenever the locale is not en_US. This works great when my code is hosted at places like Hostgator, Westhost, even GoDaddy, but it's not working on my DigitalOcean "Droplet". Here's what I get from localeconv() from Hostgator:
$locale_info => Array (18)
(
| ['decimal_point'] = String(1) "."
| ['thousands_sep'] = String(0) ""
| ['int_curr_symbol'] = String(4) "USD "
| ['currency_symbol'] = String(1) "$"
| ['mon_decimal_point'] = String(1) "."
| ['mon_thousands_sep'] = String(1) ","
| ['positive_sign'] = String(0) ""
| ['negative_sign'] = String(1) "-"
| ['int_frac_digits'] = Integer(1) 2
| ['frac_digits'] = Integer(1) 2
| ['p_cs_precedes'] = Integer(1) 1
| ['p_sep_by_space'] = Integer(1) 0
| ['n_cs_precedes'] = Integer(1) 1
| ['n_sep_by_space'] = Integer(1) 0
| ['p_sign_posn'] = Integer(1) 1
| ['n_sign_posn'] = Integer(1) 1
| ['grouping'] => Array (0)
| (
| )
| ['mon_grouping'] => Array (2)
| (
| | ['0'] = Integer(1) 3
| | ['1'] = Integer(1) 3
| )
)
And here's what it looks like on Disital Ocean:
$locale_info => Array (18)
(
| ['decimal_point'] = String(1) "."
| ['thousands_sep'] = String(0) ""
| ['int_curr_symbol'] = String(0) ""
| ['currency_symbol'] = String(0) ""
| ['mon_decimal_point'] = String(0) ""
| ['mon_thousands_sep'] = String(0) ""
| ['positive_sign'] = String(0) ""
| ['negative_sign'] = String(0) ""
| ['int_frac_digits'] = Integer(3) 127
| ['frac_digits'] = Integer(3) 127
| ['p_cs_precedes'] = Integer(3) 127
| ['p_sep_by_space'] = Integer(3) 127
| ['n_cs_precedes'] = Integer(3) 127
| ['n_sep_by_space'] = Integer(3) 127
| ['p_sign_posn'] = Integer(3) 127
| ['n_sign_posn'] = Integer(3) 127
| ['grouping'] => Array (0)
| (
| )
| ['mon_grouping'] => Array (0)
| (
| )
)
I'm guessing there is something that I need to install/setup. Anybody know what?
I'm running LAMP on Ubuntu 12.04
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×