๐ Available Languages โ
Languages โ
We currently support the following languages:
Language | Flag | Country | Number of Countries |
---|---|---|---|
Arabic | ๐ธ๐ฆ | Saudi Arabia | 25 |
Dutch | ๐ณ๐ฑ | Netherlands | 3 |
English | ๐ฌ๐ง | United Kingdom | 67 |
German | ๐ฉ๐ช | Germany | 6 |
Italian | ๐ฎ๐น | Italy | 4 |
Portuguese | ๐ง๐ท | Brazil | 9 |
Russian | ๐ท๐บ | Russia | 4 |
Spanish | ๐ช๐ธ | Spain | 21 |
Note: The "Number of Countries" refers to the estimated number of countries where the language is either official or widely spoken.
Language Management Features โ
Flexible Installation and Uninstallation: You can install or uninstall any of the supported languages at any time, or install all of them at once using a simple artisan command:
bashphp artisan w-countries:languages
This provides flexibility in managing your application's languages, without compromising its functionality.
Additional Language Options โ
Default Language (English) โ
The English language is the default and will always be installed. It cannot be removed, as it ensures base functionality. However, you can add or remove other languages at any time.
Seamless Updates โ
Languages can be installed or uninstalled without affecting the core logic of your application. This ensures that your app remains stable and functional as you manage translations.
Future Language Support โ
As new languages become available, they can be installed in under a minute, making it easy to keep your application up-to-date and accessible to a global audience.
With these features, managing languages in Laravel Countries is straightforward and efficient, ensuring your application is ready for users in multiple languages.
Configuration โ
We copy the configuration file to our project.
You will have to configure the locales your app should use.
In config/translatable.php
you can customize a lot of what the translation package offers. However, we donโt recommend making deep changes to this file, as it could lead to conflicts or bugs in our package.
INFO
Note: We're actively working on improvements to prevent this from happening in the future!
/*
|--------------------------------------------------------------------------
| Application Locales
|--------------------------------------------------------------------------
|
| Contains an array with the applications available locales.
|
*/
'locales' => [
'en',
'fr',
'es' => [
'MX', // mexican spanish
'CO', // colombian spanish
],
],
...
/*
|--------------------------------------------------------------------------
| Fallback Locale
|--------------------------------------------------------------------------
|
| A fallback locale is the locale being used to return a translation
| when the requested translation is not existing. To disable it
| set it to false.
| If set to null it will loop through all configured locales until
| one existing is found or end of list reached. The locales are looped
| from top to bottom and for country based locales the simple one
| is used first. So "es" will be checked before "es_MX".
|
*/
'fallback_locale' => 'en',
...
Required Dependencies โ
This package relies on Spatie's Laravel Translatable to handle translations efficiently. The spatie/laravel-package-tools version ^1.16.0 or higher is required for proper functionality and will be installed automatically when you install Laravel Countries as a required dependency.
About Spatie Laravel Translatable โ
Spatie Laravel Translatable is a powerful package designed to simplify working with multilingual content in Laravel applications. It allows you to easily manage translations for any model attribute. Some key features include:
- Easy Integration: Works seamlessly with Eloquent, allowing you to store and retrieve translations just like regular attributes.
- Flexible Translation Management: Store translations for multiple languages in a clean and structured way, minimizing database complexity.
- Developer-Friendly API: Provides a simple API that makes managing translations intuitive and efficient.
By leveraging Spatie Laravel Translatable, the Laravel Countries package offers seamless multilingual support across various locales.
Consider leaving a star on Spatie's Laravel Translatable GitHub repository. It's an incredible package, and we highly recommend it!