1
votes

I'm using aws-amplify in a vue.js application and was wondering if there is a way to retrieve localized error messages. I tried to do the following with no luck

setError: function(e) {
    this.$Amplify.I18n.setLanguage("es");
    this.errorMsg = this.$Amplify.I18n.get(e.message || e);
    console.log(this.errorMsg);
}
1

1 Answers

1
votes

You have to write your own vocabularies

Amplify I18n docs: https://aws-amplify.github.io/docs/js/i18n

const dict = {
    'fr': {
        'Sign In': "Se connecter",
        'Sign Up': "S'inscrire"
    },
    'es': {
        'Sign In': "Registrarse",
        'Sign Up': "RegĂ­strate"
    }
};

I18n.putVocabularies(dict)