Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EN translation #151

Merged
merged 4 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"locales": ["en"],
"defaultLocale": "en",
"pages": {
"*": ["common"],
"/": ["home"],
"/404": ["404"],
"/login": ["login"],
"/signup": ["signup"],
"/settings": ["settings"],
"/surveys": ["surveys"],
"/survey/create": ["surveyCreate"],
"/survey/answer/[surveyId]": ["surveyAnswer"],
"/survey/[surveyId]": ["survey"]
}
}
8 changes: 8 additions & 0 deletions locales/en/404.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"title": "Page Not Found",
"content": "Employee Pulse (404) - This page cannot be found.",
"Heading": "This page cannot be found.",
"Description": "Redirecting to Homepage in",
"RedirectSecond": "second",
"RedirectSeconds": "seconds"
}
24 changes: 24 additions & 0 deletions locales/en/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"navigation": {
"createSurveyButton": "Create Survey",
"mySurveysButton": "My Surveys",
"settingsButton": "Settings",
"signOutButton": "Sign out",
"signInButton": "Sign in"
},
"coping": {
"copyingSucces": "Copied to clipboard",
"copyingError": "Copy failed",
"copyingNotSupported": "Clipboard not supported"
},
"surveyRemoving": {
"surveyDeleteSuccess": "Survey deleted successfully",
"surveyDeleteError": "Survey deleted successfully",
"modalContentFirst": "Are you sure you want to",
"modalContentSecond": "delete",
"modalContentThird": "this survey?",
"modalTitle": "Delete survey",
"modalDeleteButton": "Delete",
"modelCancelButton": "Cancel"
}
}
9 changes: 9 additions & 0 deletions locales/en/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"title": "Employee Pulse",
"content": "Homepage - Employee Pulse",
"firstPartHeading": "How are you",
"secondPartHeading": "feeling?",
"Description": "There is no better way to find out than Employee Pulse?",
"buttonSignIn": "Sign In",
"buttonCreateSurvey": "Create Survey"
}
18 changes: 18 additions & 0 deletions locales/en/login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"title": "Login",
"content": "Login - Employee Pulse",
"heading": "Sign in",
"googleButton": "Sign in with Google",
"githubButton": "Sign in with Github",
"signInButton": "Sign in",
"or": "or",
"dontHaveAccount": "Don't have an account?",
"loading": "Loading...",
"email": "E-mail",
"password": "Password",
"incorrectEmail": "Incorrect email address",
"required": "Required field",
"errorSingingIn": "Error while signing in!",
"authError": "Authentication failed",
"accountWithEmailAlreadyExist": "The account already exists for that email."
}
17 changes: 17 additions & 0 deletions locales/en/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"title": "Settings",
"content": "Settings - Employee Pulse",
"heading": "Hi",
"deleteAccountButtonTitle": "Delete my account",
"deleteAccountButton": "Delete my account",
"dialogTitle": "Delete my account",
"buttonCancle": "Cancel",
"buttonConfirm": "Confirm",
"loading": "Loading...",
"dialogContentFirst": "Are you sure you want to",
"dialogContentSecond": "delete",
"dialogContentThird": "your account?",
"deleteAccountSuccess": "Your account has been deleted successfully.",
"deleteAccountError": "Error deleting account.",
"reauthorize": "'For security reasons, please sign in and delete your account again'"
}
20 changes: 20 additions & 0 deletions locales/en/signup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "Sign up",
"content": "Sign up - Employee Pulse",
"heading": "Sign up",
"signUpButton": "Sign up",
"or": "or",
"loading": "Loading...",
"email": "E-mail",
"name": "Name",
"password": "Password",
"incorrectEmail": "Incorrect email address",
"required": "Required field",
"errorSingingUp": "Error while signing up!",
"passwordLengthMin": "Password must be at least 8 characters long",
"passwordLengthMax": "Password can be up to 64 characters long",
"alreadyHaveAccount": "Already have an account?",
"authError": "Authentication failed",
"accountWithEmailAlreadyExist": "The account already exists for that email.",
"registerError": "Registration failed!"
}
14 changes: 14 additions & 0 deletions locales/en/survey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Survey",
"content": "Survey - Employee Pulse",
"sendButton": "Send",
"surveyNoLongerActive": "Oops Survey is no longer active",
"backHomeButton": "Go back to home",
"alreadyAnswered": "You have answered this survey",
"surveyIdNotFound": "Survey ID not found",
"successfullSubmit": "The reply has been sent",
"unSuccessfullSubmit": "Error occured",
"surveyInactive": "The survey is no longer active.",
"sendFeedbackTellUsMore": "Tell us more",
"choseEmojiBeforeSend": "Please select an emoji before sending."
}
22 changes: 22 additions & 0 deletions locales/en/surveyAnswer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"title": "Survey Answers",
"content": "Survey Answers - Employee Pulse",
"buttonCopyLinkTitle": "Copy link to clipboard",
"buttonCopyLink": "Copy link to clipboard",
"buttonRefreshTitle": "Refresh data",
"buttonRefresh": "Refresh",
"buttonDeleteSurveyTitle": "Delete survey",
"toggleSureveyActive": "Is survey active",
"toogleFeedback": "With extra feedback only",
"noAnswers": "No answers yet",
"refreshSuccess": "Data has been refreshed",
"toggleChangeActiveStatus": "Survey status changed to",
"toggleActive": "Active",
"toggleInactive": "Inactive",
"toggleChangeActiveStatusError": "Can not update survey status",
"createDateInformation": "Create Date",
"totalVotesInformation": "Total Votes",
"copyLinkButtonTitle": "Copy link to clipboard",
"deleteSurveyButtonTitle": "Delete survey",
"tooltipValue": "value:"
}
14 changes: 14 additions & 0 deletions locales/en/surveyCreate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Create Survey",
"content": "Create Survey - Employee Pulse",
"heading": "Create new survey",
"buttonCreate": "Create",
"emojiPickingInformation": "Click on icon to change",
"surveyTitleLable": "Survey Title",
"surveyTitlePlaceholder": "Title...",
"duplicatingEmoji": "Emoji already selected",
"required": "Required field",
"surveyCreationFailed": "Survey creation failed",
"surveyCreationSuccess": "Survey created succesfully",
"surveyCreationSucessCopiedCorrectly": "and link copied to clipboard"
}
9 changes: 9 additions & 0 deletions locales/en/surveys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"title": "Surveys",
"content": "Surveys - Employee Pulse",
"heading": "Surveys",
"headingError": "There is a problem - your surveys cannot be viewed.",
"noSurveys": "No surveys yet",
"buttonCreateSurvey": "Create Survey",
"moreButton": "More"
}
8 changes: 6 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module.exports = {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextTranslate = require('next-translate-plugin');

module.exports = nextTranslate({
images: {
domains: ['lh3.googleusercontent.com', 'avatars.githubusercontent.com'],
},
};
optimizeFonts: false,
});
63 changes: 63 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"formik": "^2.2.9",
"framer-motion": "^6.3.3",
"next": "^12.1.6",
"next-translate-plugin": "^2.0.5",
"nprogress": "^0.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
11 changes: 7 additions & 4 deletions src/features/authorization/managers/loginManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { FormikHelpers } from 'formik';
import * as Yup from 'yup';
import { logInWithEmailAndPassword } from 'firebaseConfiguration';
import useTranslation from 'next-translate/useTranslation';

export const useLoginManager = () => {
const { t } = useTranslation();
const initialValues = {
email: '',
password: '',
Expand All @@ -13,9 +15,9 @@ export const useLoginManager = () => {

const LoginSchema = Yup.object().shape({
email: Yup.string()
.email('Incorrect email address')
.required('Required field'),
password: Yup.string().required('Required field'),
.email(t('login:incorrectEmail'))
.required(t('login:required')),
password: Yup.string().required(t('login:required')),
});

const onSubmit = async (
Expand All @@ -26,10 +28,11 @@ export const useLoginManager = () => {
await logInWithEmailAndPassword({
email: values.email,
password: values.password,
authError: t('login:authError'),
});
resetForm();
} catch (e) {
setFieldError('message', 'Error while signing in!');
setFieldError('message', t('login:errorSingingIn'));
}
};

Expand Down
18 changes: 11 additions & 7 deletions src/features/authorization/managers/registerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { FormikHelpers } from 'formik';
import * as Yup from 'yup';
import { useApplicationContext } from 'features/application/context';
import { registerWithEmailAndPassword } from 'firebaseConfiguration';
import useTranslation from 'next-translate/useTranslation';

export const useRegisterManager = () => {
const { changeDisplayName } = useApplicationContext();
const [isRegistering, setIsRegistering] = useState(false);
const { t } = useTranslation();

const initialValues = {
name: '',
Expand All @@ -18,14 +20,14 @@ export const useRegisterManager = () => {
type FormValues = typeof initialValues;

const SignupSchema = Yup.object().shape({
name: Yup.string().required('Required field'),
name: Yup.string().required(t('signup:required')),
email: Yup.string()
.email('Incorrect email address')
.required('Required field'),
.email(t('signup:incorrectEmail'))
.required(t('signup:required')),
password: Yup.string()
.min(8, 'Password must be at least 8 characters long')
.max(64, 'Password can be up to 64 characters long')
.required('Required field'),
.min(8, t('signup:passwordLengthMin'))
.max(64, t('signup:passwordLengthMax'))
.required(t('signup:required')),
});

const onSubmit = async (
Expand All @@ -39,10 +41,12 @@ export const useRegisterManager = () => {
email: values.email,
password: values.password,
changeDisplayName,
registerError: t('signup:registerError'),
accountAlreadyExist: t('signup:accountAlreadyExist'),
});
resetForm();
} catch (e) {
setFieldError('message', 'Error while signing in!');
setFieldError('message', t('signup:errorSingingUp'));
}
setIsRegistering(false);
};
Expand Down
Loading