AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

StorefrontText.php 4.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace App\Storefront;
  3. /**
  4. * Messages the server shows to shoppers, in the store's language.
  5. * The words drawn by the browser live in resources/js/storefront/text.ts.
  6. */
  7. final class StorefrontText
  8. {
  9. private const array LINES = [
  10. 'en' => [
  11. 'cart_empty' => 'Your cart is empty.',
  12. 'minimum_total' => 'The order total must be at least RM 2.00.',
  13. 'sold_out' => 'This product is sold out.',
  14. 'choose_option' => 'Please choose an option first.',
  15. 'payment_unavailable' => 'We could not start the payment. Please try again in a moment.',
  16. 'discount_invalid' => 'This code is not valid.',
  17. 'discount_not_started' => 'This code cannot be used yet.',
  18. 'discount_expired' => 'This code has expired.',
  19. 'discount_used_up' => 'This code has been used up.',
  20. 'discount_minimum' => 'Spend at least :amount on products to use this code.',
  21. 'discount_total_too_low' => 'After the discount, the order total must be at least RM 2.00.',
  22. 'discount_changed' => 'Your discount code can no longer be used, so it was removed. Please check your total.',
  23. ],
  24. 'ms' => [
  25. 'cart_empty' => 'Troli anda kosong.',
  26. 'minimum_total' => 'Jumlah pesanan mestilah sekurang-kurangnya RM 2.00.',
  27. 'sold_out' => 'Produk ini telah habis dijual.',
  28. 'choose_option' => 'Sila pilih satu pilihan dahulu.',
  29. 'payment_unavailable' => 'Kami tidak dapat memulakan pembayaran. Sila cuba sebentar lagi.',
  30. 'discount_invalid' => 'Kod ini tidak sah.',
  31. 'discount_not_started' => 'Kod ini belum boleh digunakan.',
  32. 'discount_expired' => 'Kod ini telah tamat tempoh.',
  33. 'discount_used_up' => 'Kod ini telah habis digunakan.',
  34. 'discount_minimum' => 'Belanja sekurang-kurangnya :amount untuk produk bagi menggunakan kod ini.',
  35. 'discount_total_too_low' => 'Selepas diskaun, jumlah pesanan mestilah sekurang-kurangnya RM 2.00.',
  36. 'discount_changed' => 'Kod diskaun anda tidak lagi boleh digunakan, jadi ia telah dibuang. Sila semak jumlah anda.',
  37. ],
  38. ];
  39. /**
  40. * @param array<string, string> $replace Words to put in, such as [':amount' => 'RM 50.00'].
  41. */
  42. public static function line(string $language, string $key, array $replace = []): string
  43. {
  44. return strtr(self::LINES[$language][$key] ?? self::LINES['en'][$key], $replace);
  45. }
  46. /**
  47. * Messages for the checkout form's checks.
  48. *
  49. * @return array<string, string>
  50. */
  51. public static function checkoutMessages(string $language): array
  52. {
  53. if ($language === 'ms') {
  54. return [
  55. 'required' => ':attribute diperlukan.',
  56. 'string' => ':attribute tidak sah.',
  57. 'email' => ':attribute mestilah alamat e-mel yang sah.',
  58. 'min' => ':attribute mestilah sekurang-kurangnya :min aksara.',
  59. 'max' => ':attribute tidak boleh melebihi :max aksara.',
  60. 'phone.regex' => 'Sila masukkan nombor telefon yang sah.',
  61. 'postcode.regex' => 'Poskod mestilah 5 digit.',
  62. 'state.in' => 'Sila pilih negeri.',
  63. ];
  64. }
  65. return [
  66. 'phone.regex' => 'Please enter a valid phone number.',
  67. 'postcode.regex' => 'The postcode must be 5 digits.',
  68. 'state.in' => 'Please choose a state.',
  69. ];
  70. }
  71. /**
  72. * How the checkout fields are named inside those messages.
  73. *
  74. * @return array<string, string>
  75. */
  76. public static function checkoutFields(string $language): array
  77. {
  78. return $language === 'ms'
  79. ? ['name' => 'Nama penuh', 'email' => 'E-mel', 'phone' => 'Nombor telefon', 'line1' => 'Alamat', 'line2' => 'Alamat baris 2', 'city' => 'Bandar', 'postcode' => 'Poskod', 'state' => 'Negeri']
  80. : ['name' => 'full name', 'email' => 'email', 'phone' => 'phone number', 'line1' => 'address', 'line2' => 'address line 2', 'city' => 'city', 'postcode' => 'postcode', 'state' => 'state'];
  81. }
  82. }