简体   繁体   中英

I18n::InvalidLocaleData rails error

I am little confused in using rails yaml file.

My app throwing following error

I18n::InvalidLocaleData

My yaml file is

en:
  auth:
    register:
        success: "Successfully registered"
        error: "Please correct the errors"

My controller is

class AuthController < ApplicationController

def register
    blahblah
    flash[:error] = t '.auth.register.error'
end

Can anyone help how to use yaml. I checked with yamlint it shows valid YAML

Isn't your indentation wrong between the register: and the success: "Successfully registered" lines? It seems that you have 2 more spaces there, also keep in mind that you have to use spaces and avoid tabs, make sure you're using spaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM