Localeapp doesn't work in string

I put the custom error message in phone field and I want to translate to that message too when user change the language of the web.

But i don't know why, the locale app is not responding at all.

Here's my code for that.

<div class="col-sm-12 input-group">
  <%= u.text_field :tel,type: "tel", pattern: "^[0-9\+]{8,14}$", placeholder: "0123456789", class: "form-control", id: "listing_owner_mob", oninvalid: "setCustomValidity(#{I18n.t('admin.listings.edit.comments.error_message')})" %>

1 answer

  • answered 2018-07-11 07:07 Sujay Gavhane

    You will need to set

    I18n.locale = <User input language>

    Then only it will work.

    Please check if you have set it.