translatable.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Application Locales
  6. |--------------------------------------------------------------------------
  7. |
  8. | Contains an array with the applications available locales.
  9. |
  10. */
  11. 'locales' => [
  12. 'en',
  13. 'fr',
  14. 'es' => [
  15. 'MX', // mexican spanish
  16. 'CO', // colombian spanish
  17. ],
  18. ],
  19. /*
  20. |--------------------------------------------------------------------------
  21. | Locale separator
  22. |--------------------------------------------------------------------------
  23. |
  24. | This is a string used to glue the language and the country when defining
  25. | the available locales. Example: if set to '-', then the locale for
  26. | colombian spanish will be saved as 'es-CO' into the database.
  27. |
  28. */
  29. 'locale_separator' => '-',
  30. /*
  31. |--------------------------------------------------------------------------
  32. | Default locale
  33. |--------------------------------------------------------------------------
  34. |
  35. | As a default locale, Translatable takes the locale of Laravel's
  36. | translator. If for some reason you want to override this,
  37. | you can specify what default should be used here.
  38. | If you set a value here it will only use the current config value
  39. | and never fallback to the translator one.
  40. |
  41. */
  42. 'locale' => null,
  43. /*
  44. |--------------------------------------------------------------------------
  45. | Use fallback
  46. |--------------------------------------------------------------------------
  47. |
  48. | Determine if fallback locales are returned by default or not. To add
  49. | more flexibility and configure this option per "translatable"
  50. | instance, this value will be overridden by the property
  51. | $useTranslationFallback when defined
  52. |
  53. */
  54. 'use_fallback' => true,
  55. /*
  56. |--------------------------------------------------------------------------
  57. | Use fallback per property
  58. |--------------------------------------------------------------------------
  59. |
  60. | The property fallback feature will return the translated value of
  61. | the fallback locale if the property is empty for the selected
  62. | locale. Note that 'use_fallback' must be enabled.
  63. |
  64. */
  65. 'use_property_fallback' => true,
  66. /*
  67. |--------------------------------------------------------------------------
  68. | Fallback Locale
  69. |--------------------------------------------------------------------------
  70. |
  71. | A fallback locale is the locale being used to return a translation
  72. | when the requested translation is not existing. To disable it
  73. | set it to false.
  74. | If set to null it will loop through all configured locales until
  75. | one existing is found or end of list reached. The locales are looped
  76. | from top to bottom and for country based locales the simple one
  77. | is used first. So "es" will be checked before "es_MX".
  78. |
  79. */
  80. 'fallback_locale' => 'en',
  81. /*
  82. |--------------------------------------------------------------------------
  83. | Translation Model Namespace
  84. |--------------------------------------------------------------------------
  85. |
  86. | Defines the default 'Translation' class namespace. For example, if
  87. | you want to use App\Translations\CountryTranslation instead of App\CountryTranslation
  88. | set this to 'App\Translations'.
  89. |
  90. */
  91. 'translation_model_namespace' => null,
  92. /*
  93. |--------------------------------------------------------------------------
  94. | Translation Suffix
  95. |--------------------------------------------------------------------------
  96. |
  97. | Defines the default 'Translation' class suffix. For example, if
  98. | you want to use CountryTrans instead of CountryTranslation
  99. | application, set this to 'Trans'.
  100. |
  101. */
  102. 'translation_suffix' => 'Translation',
  103. /*
  104. |--------------------------------------------------------------------------
  105. | Locale key
  106. |--------------------------------------------------------------------------
  107. |
  108. | Defines the 'locale' field name, which is used by the
  109. | translation model.
  110. |
  111. */
  112. 'locale_key' => 'locale',
  113. /*
  114. |--------------------------------------------------------------------------
  115. | Always load translations when converting to array
  116. |--------------------------------------------------------------------------
  117. | Setting this to false will have a performance improvement but will
  118. | not return the translations when using toArray(), unless the
  119. | translations relationship is already loaded.
  120. |
  121. */
  122. 'to_array_always_loads_translations' => true,
  123. /*
  124. |--------------------------------------------------------------------------
  125. | Configure the default behavior of the rule factory
  126. |--------------------------------------------------------------------------
  127. | The default values used to control the behavior of the RuleFactory.
  128. | Here you can set your own default format and delimiters for
  129. | your whole app.
  130. *
  131. */
  132. 'rule_factory' => [
  133. 'format' => \Astrotomic\Translatable\Validation\RuleFactory::FORMAT_ARRAY,
  134. 'prefix' => '%',
  135. 'suffix' => '%',
  136. ],
  137. ];