I'm using the vue-i18n library to translate between Spanish and English for the website text like page title, form names, button names, and text that is not going to change except for the translation, text not saved in the database.
I want to know if there is a way to also translate the user input like a name that's saved in the db, for example a category name such as Wine, when the page is in Spanish how can I display Wine as Vino?
But it won't be 100% correct in all languages as Google doesn't know the context. Especially if you only translate 1 word and not a full sentence. A word in english could have multiple meanings in another language.
@click Could you give me your opinion on how to handle translating certain inputs? For example my project is an online store and for now I want to translate only the category names. I found this library https://github.com/aurawindsurfing/google-translate and have installed it, how should I handle the actual translation, should I save it in the db or translate it everytime according to the config/app locale.
This is what I have right now, but I'm not sure if I should save over the current name value or if I should add a new value for the translated name? What would be the best way?
$translator = new Translator();
$categories = Category::all();
$categories->each(function ($item) {
if (App::getLocale() === 'en'){
} else {
}
});
Actually looking back on your example docs I'm confused how do I install that google translator to use it in my project, I can't seem to find it. I was reading about it and it seems I have to enable the api key but I haven't been able to do that either.