LangCountry launches v4
Published on by Eric L. Barnes
Laravel LangCountry just launched version 4. If you are not familiar with the package here is what it does:
Laravel has great localisation functionality, but it is all based on the locale. The locale only refers to a language, not a country. This package adds the ability to localize based on the country. Why? Mainly because dates dates can be pronounced the same in a language, but be formatted differently in different countries. The package also adds more convenience functions to get localized country names, currency symbols and more.
Veresion 4 now includes adding Carbon Macros so you can use the LangCountry formatting directly on your Carbon instances. On most IDE's they're also autocompleted for convenience.
Examples:
session(['lang_country' => 'nl-NL']);$post->created_at->langCountryDateNumbers(); // Will return "27-09-2023" // You can also include the time by adding `true` as the second parameter.$post->created_at->langCountryDateWordsWithDay(false, true); // Will return "Wednesday September 27th 2023 01:05 pm"
For more information check out our original write up on Laravel LangCountry and visit the official docs.
Eric is the creator of Laravel News and has been covering Laravel since 2012.