feat: i18n user interface (#40306)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Tom
2020-12-16 02:02:52 -06:00
committed by Mrugesh Mohapatra
parent a60a887e63
commit 3978c6be28
149 changed files with 3408 additions and 1084 deletions

View File

@@ -4,6 +4,7 @@ import { Image } from '@freecodecamp/react-bootstrap';
import DefaultAvatar from '../../assets/icons/DefaultAvatar';
import { defaultUserImage } from '../../../../config/misc';
import { borderColorPicker } from '../helpers';
import { useTranslation } from 'react-i18next';
const propTypes = {
isDonating: PropTypes.bool,
@@ -13,6 +14,7 @@ const propTypes = {
};
function AvatarRenderer({ picture, userName, isDonating, isTopContributor }) {
const { t } = useTranslation();
let borderColor = borderColorPicker(isDonating, isTopContributor);
let isPlaceHolderImage =
/example.com|identicon.org/.test(picture) || picture === defaultUserImage;
@@ -23,7 +25,7 @@ function AvatarRenderer({ picture, userName, isDonating, isTopContributor }) {
<DefaultAvatar className='avatar default-avatar' />
) : (
<Image
alt={userName + "'s avatar"}
alt={t('profile.avatar', { username: userName })}
className='avatar'
responsive={true}
src={picture}

View File

@@ -1,8 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from '@freecodecamp/react-bootstrap';
import { useTranslation } from 'react-i18next';
function BlockSaveButton({ children, ...restProps }) {
const { t } = useTranslation();
return (
<Button
block={true}
@@ -11,7 +14,7 @@ function BlockSaveButton({ children, ...restProps }) {
type='submit'
{...restProps}
>
{children || 'Save'}
{children || t('buttons.save')}
</Button>
);
}