Basically we can localize the strings in the application using trans() method after making an array in lang directory. But that is kind of hard coding. For example, if we want to translate a message. we would do something like this.
/resources
/lang
/en
messages.php
/es
messages.php
and then we make an array and hard code it. just like
<?php
return [
'welcome' => 'Welcome to our application'
];
But what if data is coming from database? we do not know how many records are coming and what is in the database. For example, we have an articles and we want to translate its title to other language say to French. How can we accomplish this without any package ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire