laravel translate using json file

197 Views Asked by At

I have multilingual application using laravel 6.2, and i want to translate terms imported from the database, so I use the following code:

<td>{{ __($specs) }}</td>

Examples of some specs in json file:

"Display" : "Monitor",
"Processor" : "Procesador",
"RAM" : "RAM",
"Rear Camera" : "Cámara trasera",

Until now, everything is fine.

But the problem is when importing variable expressions, for example:

5 inches
143 grams

I don't want to do this every time

  "5 inches" : "5 pulgadas",
  "6.5 inches" : "6.5 pulgadas",
  "5.61 inches" : "5.61 pulgadas",
  "6.54 inches" : "6.54 pulgadas",
  "7 inches" : "7 pulgadas",
  .
  .
  .

Is there a way to translate the word "inches" only once?

0

There are 0 best solutions below