You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transmatic.php 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. use Wallo\Transmatic\Services\Translators\AwsTranslate;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Default Translation Service
  7. |--------------------------------------------------------------------------
  8. |
  9. | Controls the default service to use for translations. The "timeout"
  10. | option limits the wait time, in seconds, for a response from the
  11. | translation service. The "placeholder_format" option specifies the
  12. | format that your translation service uses for placeholders. For example,
  13. | if you set this to "#placeholder", then the translation service will
  14. | look for placeholders such as "#name", "#age", etc. Note that this format
  15. | is only for the translation service; you should continue using Laravel's
  16. | default ":placeholder" format when passing text to be translated. The
  17. | "supports_placeholders" flag indicates whether your translation service
  18. | is capable of supporting placeholders. Set to "true" if the service can
  19. | handle placeholders, or "false" otherwise.
  20. |
  21. */
  22. 'translator' => [
  23. 'default' => AwsTranslate::class,
  24. 'timeout' => env('TRANSMATIC_TRANSLATOR_TIMEOUT', 30),
  25. 'placeholder_format' => '#placeholder',
  26. 'supports_placeholders' => true,
  27. ],
  28. /*
  29. |--------------------------------------------------------------------------
  30. | Source Locale
  31. |--------------------------------------------------------------------------
  32. |
  33. | The source locale to be used for all translations. This is the language
  34. | code from which all translations to other languages will be made. This
  35. | must be the language that your application is written in.
  36. |
  37. */
  38. 'source_locale' => env('TRANSMATIC_SOURCE_LOCALE', 'en'),
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Translation Storage
  42. |--------------------------------------------------------------------------
  43. |
  44. | The mechanism used for storing translations. You can choose between
  45. | either storing translations in the cache or in JSON language files.
  46. |
  47. | Supported: "cache", "file"
  48. |
  49. */
  50. 'storage' => env('TRANSMATIC_STORAGE', 'file'),
  51. /*
  52. |--------------------------------------------------------------------------
  53. | Cache Configuration
  54. |--------------------------------------------------------------------------
  55. |
  56. | Here you may configure the options for caching translations. The
  57. | "duration" specifies the number of days that translations should be
  58. | cached for. This can help improve performance by reducing redundant
  59. | translation operations. The "key" is the name of the base cache key that
  60. | will be used to store the translations. The locale will be appended to
  61. | this key.
  62. |
  63. */
  64. 'cache' => [
  65. 'key' => env('TRANSMATIC_CACHE_KEY', 'translations'),
  66. 'duration' => env('TRANSMATIC_CACHE_DURATION', 30),
  67. ],
  68. /*
  69. |--------------------------------------------------------------------------
  70. | File Configuration
  71. |--------------------------------------------------------------------------
  72. |
  73. | Here you may configure the options for storing translations in JSON. The
  74. | "path" specifies the directory where the JSON language files will be
  75. | stored. Defaults to "resources/data/lang" to bypass Laravel's auto-reload
  76. | feature for "lang" directories.
  77. |
  78. */
  79. 'file' => [
  80. 'path' => env('TRANSMATIC_FILE_PATH', 'resources/data/lang'),
  81. ],
  82. /*
  83. |--------------------------------------------------------------------------
  84. | Job Configuration
  85. |--------------------------------------------------------------------------
  86. |
  87. | Here you may configure the options for translation jobs. The "chunk_size"
  88. | specifies the number of text string per job, "max_attempts" specifies
  89. | the retry limit before marking a job as failed, and "retry_duration"
  90. | specifies the number of seconds to wait before retrying a failed job.
  91. |
  92. */
  93. 'job' => [
  94. 'chunk_size' => 200,
  95. 'max_attempts' => 3,
  96. 'retry_duration' => 60,
  97. ],
  98. /*
  99. |--------------------------------------------------------------------------
  100. | Batching Configuration
  101. |--------------------------------------------------------------------------
  102. |
  103. | Here you may configure the connection and queue for translation batches.
  104. | You may also specify whether or not to allow failures for the batch.
  105. |
  106. */
  107. 'batching' => [
  108. 'name' => 'TransmaticBatch',
  109. 'connection' => env('TRANSMATIC_BATCHING_CONNECTION', 'database'),
  110. 'queue' => env('TRANSMATIC_BATCHING_QUEUE', 'translations'),
  111. 'allow_failures' => env('TRANSMATIC_BATCHING_ALLOW_FAILURES', true),
  112. ],
  113. ];