I integrated i18n-next in my Vue3 project and it works for elements like headers or labels with the known syntax {{ $t ("something") }}, but I can't get it to work with the value or placeholder of things like <input type="submit" value="This should be variable" class=... />
What is the correct way to do this?
2 Answers
Solution for use i18n in input placeholder and value in Vue3.js and Nuxt3.js
For placeholder you must add empty space or string to $t('something')
equal :placeholder="$t('something')+' '"
but for value just $t('something') equal :value="$t('something')"
Your code
<input type="submit" :placeholder="$t('something')+' '" :value="$t('something')" class="" />
#or
<input type="submit" :placeholder="$t('something')+'.'" :value="$t('something')" class="" />
Sample code search
<input type="text" :placeholder="$t('what_are_you_looking_for')+' '" :value="$t('what_are_you_looking_for')" class="form-control">
#or
<input type="text" :placeholder="$t('what_are_you_looking_for')+'...'" :value="$t('what_are_you_looking_for')" class="form-control">
Finish!
<input type="submit" :value="$t('placeholder')" class=... />