CodeIgniter Forums

Full Version: What about a Country helper class.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just one thought,

Wouldn't it be helpful to have a country helper class? Just as we already have a language class.

Why?

Well for the following reasons:

Internationalization is not only a language issue and yes also a location issue.

I could stay, let's say in Germany while my preferred language is English. But this doesn't mean that I want to use decimal points instead of commas. The currency sign depends on the country, not the language. The validation rules for addresses (zipcodes, states etc..) depends on the country, not on the language.

I don't think it is a big effort to "copy" the language helper to a country helper. But the result would be great because we will be able to organize things better and more efficient.

I would like to receive critics, suggestions etc... on this issue.

Thanks,

Geraldo.
This idea possibly has some legs to it. I had not thought about this before but it could help. It could also config the time and date settings too possibly. Not sure it would work like the language helper, but similar I suppose. You could also use it to set the telephone number for that country too, or the delivery methods etc.

I am also guessing that you might create a file for one country, and then let others in their own countries create their own based on that template.

It is an interesting idea.

Paul.
It shouldn't be "Country"... it should be "Locale"... even a country can have different settings depending on which locale you adhere to.
That's a good point too.
(09-28-2017, 01:46 AM)Tripex Wrote: [ -> ]It shouldn't be "Country"... it should be "Locale"... even a country can have different settings depending on which locale you adhere to.
I understand you, but yes what I was thinking of is a Country helper. Just for things like zipcode formats, phone numbers, currency and things like that. I have to validate addresses, but the validation rules depend on the country, I need to know if a country is using decimals in currency data, and if so how many decimals. I resolved this with database functionality, but I thought that it would be nice to have the same kind of solution as with the Language helper.

Other country-specific things could be licenses, discount options etc... So it is a little bit different from the "standard" Locales approach.
May be this is related
Link to number format helper function in ci4
This is  wrapper function for using  format function of php Internationalization Extention 
(10-04-2017, 08:26 AM)jaynarayan Wrote: [ -> ]May be this is related
Link to number format helper function in ci4
This is  wrapper function for using  format function of php Internationalization Extention 

Thanks for your reply!