salarmehr / cosmopolitan Goto Github PK
View Code? Open in Web Editor NEW๐ Super efficient app internationalization
๐ Super efficient app internationalization
Just noticed a recurring message in my log
PHP Deprecated: Return type of Salarmehr\Cosmopolitan\Bundle::get($index, $fallback = null) should either be compatible with ResourceBundle::get($index, bool $fallback = true): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/aperassociation/vendor/salarmehr/cosmopolitan/src/Bundle.php on line 20
PHP 8.1.17 (cli) (built: Mar 16 2023 14:38:37) (NTS)
error function customTime
Undefined property: Salarmehr\Cosmopolitan\Cosmo::$calendarType
In your example you have the timezone and the currency identifier as external values, but it is possible to determine them:
$locale = 'de-DE';
$country_code = Locale::getRegion($locale);
$timezone = DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $country_code)[0];
$currency = (new NumberFormatter($locale, NumberFormatter::CURRENCY))->getTextAttribute(NumberFormatter::CURRENCY_CODE);
print_r([$country_code, $timezone, $currency]);
To be fair: :) The timezone is a one-to-many-relationsship, but should work for most countries.
And if we have this values we would be able to omit these parameters in those methods:
language()
country()
currency()
money()
So you would have just to type $intl->language() to get the current language.
What do you think?
Hi there, is there a way we can get the no_decimal, decimal point, the thousands_sep values? Thank you
@salarmehr Wrapping all the mostly undocumented intl
stuff isn't easy. So I thought I stop by and leave a thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.