I am using laravel 5.2.i want to convert our data to Hindi. I have one table with 60 columns and that data is saved in english but I want to convert in to Hindi. I have read the localization tutorial but there is no proper explanation can anyone help me to achieve this functionality I don't want to store our data in Hindi in our database.
-
1localization will not work for data saved in database, and for database oriented data, you need to save in unicode (directly hindi unicode). THis is the fact regarding your data. But no worries if you want to translate your DB data into hindi use google translation API. – BetaDev Apr 27 '17 at 05:32
2 Answers
There are easy ways and hard ways to tackle this issue.
The easiest solution would be to add a Google Translate widget to your web-page, that would allow a user to translate the content on the site quickly and easily into almost any other language.
https://translate.google.com/manager/website/
A somewhat more specific solution that works well but requires a bit of effort is to use a library like translatejs
The only issue with something like translatejs is that you would need to write all of the words into it that you want to use and their translations, effectively creating a word for word translation that you manually curate.
All in all I would probably recommend giving jTextTranslate a go. It uses the Google Translate functionality but does it as an API call to reduce the impact it has on your page/load times/etc. You can find it here: https://tympanus.net/codrops/2009/11/30/jtexttranslate-a-jquery-translation-plugin/

- 347
- 1
- 9
-
Note the above examples generally use JavaScript and sometimes jQuery. Laravel is all server-side PHP but if you're not wanting the hindi stored server-side (in the database) then you're looking for more of a client side (javascript / jQuery) solution :-) – William Cross Apr 27 '17 at 05:32
To use the laravel localization you need to store the static strings locally in one file.
Lets say you have one file named message.php
which has all the messages.
return [
'success' => 'Your success message',
]
This file will be stored in resources/Lang/en/
folder.
Now to support French you need to create another folder named fr
within resources/Lang/
folder. You manually need to convert all the language resources.
If you don't want to manually convert, use the Google Translation.

- 2,523
- 11
- 19