Laraship

⌘K
  1. Home
  2. Docs
  3. Laraship
  4. Configuration
  5. Localization

Localization

  • Laraship supports both Content localization and UI Localization.
  • Default Language can be set under config/app.php, variable name called ‘locale’
  • We refer to content localization the data that are stored in the database and managed through the admin/dashboard panel, like Menu, CMS.
  • UI localization includes Field Labels, messages like error messages, success messages and titles.
  1. Define your website languages:

First, you need to determine your website languages, this can be set from settings >> General >> Supported system languages.

available values can be found Corals\core\Foundation\config\language.php file.

2) Once you select your supported languages, you will see a language selector at the content translation you can switch between languages to add the content related to that language.

3) translatable fields are configured inside the config file for each module, for example, CMS module at Corals/modules/CMS/config/cms.php you will see a section called translatable that specifies the fields

4) the fallback content will be displayed if there is no translation set for that custom language.

5) for GUI translations, they are managed using Laravel standard localization https://laravel.com/docs/5.5/localization,

  • each module has its own translation files which can be found under Corals/modules/[Module Name]/resource/lang/[language Code].
  • Theme translation files can be found under /resource/themes/[Theme Name]/resource/lang/[Language Code]

6) Laraship is shipped with Google Translation Command that can be used to create an initial translation, however, don’t trust google translation and we cannot guarantee the stability of this service as its free), let’s assume you are looking to create a google translated version of the  CMS for French

Module Namespace value can be grabbed from Module Service provider within the command that loads translation files

for example

  • Module Name: Foundation
  • ServiceProvider: FoundationServiceProvider.php
$this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'Corals');

This means Module space Name is Corals

for CMS

php artisan translate --module=corals-cms --namespace=CMS --from=en --to=fr

 

Theme Namespace can be grabbed from theme.json under resources/themes/[your-theme]/theme.json

for example

Marketplace Master Theme

  • resources/themes/marketplace-master/theme.json
"name": "corals-marketplace-master",

This means Theme namespace value is corals-marketplace-master

and the –theme option should be the theme folder name which is marketplace-master

if you are looking to translate a theme, for example, corals saas theme:

php artisan translate --theme=saas --namespace=corals-saas --from=en --to=fr

7) to avoid losing translation changes on the update we highly recommend checking our documentation on how to override Languages

https://www.laraship.com/docs/laraship/customize-laraship/customize-translation-files/