From e09750cd352e9853eb2fb72684985e9fcc28503b Mon Sep 17 00:00:00 2001 From: Erik Hanchett Date: Mon, 9 May 2022 13:54:56 -0700 Subject: [PATCH 1/4] Added new missing translation --- .../sign-in-with-phone.component.ts | 16 +++++++++++++--- .../sign-in-with-phone/index.page.tsx | 11 +++++++++-- .../authenticator/sign-in-with-phone/index.vue | 11 +++++++++-- .../force-change-password-phone-failure.json | 4 ++++ .../e2e/cypress/integration/common/shared.ts | 4 ++++ .../e2e/cypress/integration/common/sign-up.ts | 4 ++++ .../sign-in-force-new-password.feature | 16 ++++++++++++++++ .../ForceNewPassword/ForceNewPassword.tsx | 9 +++------ 8 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 packages/e2e/cypress/fixtures/force-change-password-phone-failure.json diff --git a/examples/angular/src/pages/ui/components/authenticator/sign-in-with-phone/sign-in-with-phone.component.ts b/examples/angular/src/pages/ui/components/authenticator/sign-in-with-phone/sign-in-with-phone.component.ts index 710a9936343..f0d39ec228f 100644 --- a/examples/angular/src/pages/ui/components/authenticator/sign-in-with-phone/sign-in-with-phone.component.ts +++ b/examples/angular/src/pages/ui/components/authenticator/sign-in-with-phone/sign-in-with-phone.component.ts @@ -1,17 +1,27 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; -import { Amplify } from 'aws-amplify'; +import { Amplify, I18n } from 'aws-amplify'; +import { translations } from '@aws-amplify/ui-angular'; import awsExports from './aws-exports'; @Component({ selector: 'sign-in-with-phone', templateUrl: 'sign-in-with-phone.component.html', }) -export class SignInWithPhoneComponent { +export class SignInWithPhoneComponent implements OnInit { constructor() { Amplify.configure(awsExports); } + ngOnInit(): void { + I18n.putVocabularies(translations); + I18n.setLanguage('en'); + I18n.putVocabulariesForLanguage('en', { + 'Password does not conform to policy: Password not long enough': + 'Your password is too short! Try a longer password!', + }); + } + public formFields = { signIn: { username: { diff --git a/examples/next/pages/ui/components/authenticator/sign-in-with-phone/index.page.tsx b/examples/next/pages/ui/components/authenticator/sign-in-with-phone/index.page.tsx index 5d33af3f373..cb0bd8ba1db 100644 --- a/examples/next/pages/ui/components/authenticator/sign-in-with-phone/index.page.tsx +++ b/examples/next/pages/ui/components/authenticator/sign-in-with-phone/index.page.tsx @@ -1,11 +1,18 @@ -import { Amplify } from 'aws-amplify'; +import { Amplify, I18n } from 'aws-amplify'; -import { withAuthenticator } from '@aws-amplify/ui-react'; +import { withAuthenticator, translations } from '@aws-amplify/ui-react'; import '@aws-amplify/ui-react/styles.css'; import awsExports from './aws-exports'; Amplify.configure(awsExports); +I18n.putVocabularies(translations); +I18n.setLanguage('en'); +I18n.putVocabulariesForLanguage('en', { + 'Password does not conform to policy: Password not long enough': + 'Your password is too short! Try a longer password!', +}); + const formFields = { signIn: { username: { diff --git a/examples/vue/src/pages/ui/components/authenticator/sign-in-with-phone/index.vue b/examples/vue/src/pages/ui/components/authenticator/sign-in-with-phone/index.vue index 2d4a22e9b12..96f1b5cd8bd 100644 --- a/examples/vue/src/pages/ui/components/authenticator/sign-in-with-phone/index.vue +++ b/examples/vue/src/pages/ui/components/authenticator/sign-in-with-phone/index.vue @@ -1,11 +1,18 @@