Fix missing translations (#475)
* fix fixmes * fix translation generation
This commit is contained in:
parent
554ff15815
commit
d713f48a51
@ -1,6 +1,29 @@
|
||||
// Copyright 2019-2020 @polkadot/extension authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const typescript = require('typescript');
|
||||
|
||||
function transform (file, enc, done) {
|
||||
const { ext } = path.parse(file.path);
|
||||
|
||||
if (ext === '.tsx') {
|
||||
const content = fs.readFileSync(file.path, enc);
|
||||
|
||||
const { outputText } = typescript.transpileModule(content, {
|
||||
compilerOptions: {
|
||||
target: 'es2018'
|
||||
},
|
||||
fileName: path.basename(file.path)
|
||||
});
|
||||
|
||||
this.parser.parseFuncFromString(outputText);
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
input: [
|
||||
'packages/extension-ui/src/**/*.{ts,tsx}',
|
||||
@ -29,5 +52,6 @@ module.exports = {
|
||||
component: 'Trans'
|
||||
}
|
||||
},
|
||||
output: './'
|
||||
output: './',
|
||||
transform
|
||||
};
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
// Copyright 2019-2020 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { ThemeProps } from '../../types';
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { ActionText, Title } from '../../components';
|
||||
import useTranslation from '../../hooks/useTranslation';
|
||||
|
||||
interface Props {
|
||||
step: number;
|
||||
onClick: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
function CreationStep ({ className, onClick, step }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<div>
|
||||
<CreateAnAccount />
|
||||
<CurrentStep>{step}</CurrentStep>
|
||||
<TotalSteps>/2</TotalSteps>
|
||||
</div>
|
||||
<ActionText
|
||||
onClick={onClick}
|
||||
text={step === 1 ? t('Cancel') : t('Back')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// FIXME i18n
|
||||
const CreateAnAccount = styled(Title).attrs(() => ({
|
||||
children: 'Create an account:'
|
||||
}))`
|
||||
display: inline;
|
||||
margin-right: 10px;
|
||||
`;
|
||||
|
||||
const CurrentStep = styled.span`
|
||||
font-size: ${({ theme }: ThemeProps): string => theme.labelFontSize};
|
||||
line-height: ${({ theme }: ThemeProps): string => theme.labelLineHeight};
|
||||
color: ${({ theme }: ThemeProps): string => theme.primaryColor};
|
||||
font-weight: 600;
|
||||
`;
|
||||
|
||||
const TotalSteps = styled.span`
|
||||
font-size: ${({ theme }: ThemeProps): string => theme.labelFontSize};
|
||||
line-height: ${({ theme }: ThemeProps): string => theme.labelLineHeight};
|
||||
color: ${({ theme }: ThemeProps): string => theme.textColor};
|
||||
font-weight: 600;
|
||||
`;
|
||||
|
||||
export default styled(CreationStep)`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 17px;
|
||||
`;
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2019-2020 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import React, { useContext, useMemo } from 'react';
|
||||
|
||||
import { AccountContext, InputWithLabel, ValidatedInput } from '../components';
|
||||
import useTranslation from '../hooks/useTranslation';
|
||||
@ -16,12 +16,10 @@ interface Props {
|
||||
onChange: (name: string | null) => void;
|
||||
}
|
||||
|
||||
// FIXME i18n
|
||||
const isNameValid = isNotShorterThan(3, 'Account name is too short');
|
||||
|
||||
export default function Name ({ address, className, isFocused, label, onBlur, onChange }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { accounts } = useContext(AccountContext);
|
||||
const isNameValid = useMemo(() => isNotShorterThan(3, t<string>('Account name is too short')), [t]);
|
||||
|
||||
const account = accounts.find((account) => account.address === address);
|
||||
const startValue = account && account.name;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2019-2020 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useCallback, useEffect, useMemo } from 'react';
|
||||
|
||||
import { InputWithLabel, ValidatedInput } from '../components';
|
||||
import useTranslation from '../hooks/useTranslation';
|
||||
@ -14,17 +14,15 @@ interface Props {
|
||||
|
||||
const MIN_LENGTH = 6;
|
||||
|
||||
// FIXME i18n
|
||||
const isFirstPasswordValid = isNotShorterThan(MIN_LENGTH, 'Password is too short');
|
||||
const isSecondPasswordValid = (firstPassword: string): Validator<string> => allOf(
|
||||
isNotShorterThan(MIN_LENGTH, 'Password is too short'),
|
||||
isSameAs(firstPassword, 'Passwords do not match')
|
||||
);
|
||||
|
||||
export default function Password ({ isFocussed, onChange }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const [pass1, setPass1] = useState<string | null>(null);
|
||||
const [pass2, setPass2] = useState<string | null>(null);
|
||||
const isFirstPasswordValid = useMemo(() => isNotShorterThan(MIN_LENGTH, t<string>('Password is too short')), [t]);
|
||||
const isSecondPasswordValid = useCallback((firstPassword: string): Validator<string> => allOf(
|
||||
isNotShorterThan(MIN_LENGTH, t<string>('Password is too short')),
|
||||
isSameAs(firstPassword, t<string>('Passwords do not match'))
|
||||
), [t]);
|
||||
|
||||
useEffect((): void => {
|
||||
onChange(pass1 && pass2 ? pass1 : null);
|
||||
|
||||
@ -15,8 +15,12 @@
|
||||
"External QR accounts and Access": "",
|
||||
"Allow Camera Access": "",
|
||||
"Display address format For": "",
|
||||
"Language": "",
|
||||
"Open extension in new window": "",
|
||||
"Account name is too short": "",
|
||||
"A descriptive name for your account": "",
|
||||
"Password is too short": "",
|
||||
"Passwords do not match": "",
|
||||
"A new password for this account": "",
|
||||
"Repeat password for verification": "",
|
||||
"Rename": "",
|
||||
@ -24,15 +28,14 @@
|
||||
"Export Account": "",
|
||||
"Forget Account": "",
|
||||
"Visible (always inject)": "",
|
||||
"You currently don't have any accounts. Create your first account to get started.": "",
|
||||
"You currently don't have any accounts. Create your first account to get started.": "",
|
||||
"Accounts": "",
|
||||
"Authorize": "",
|
||||
"Only approve this request if you trust the application. Approving gives the application access to the addresses of your accounts.": "",
|
||||
"Yes, allow this application access": "",
|
||||
"Add the account with the generated seed": "",
|
||||
"Cancel": "",
|
||||
"Create an account": "",
|
||||
"Please write down your wallet’s mnemonic seed and keep it in a safe place. The mnemonic can be used to restore your wallet. Keep it carefully to not lose your assets.": "",
|
||||
"Please write down your wallet's mnemonic seed and keep it in a safe place. The mnemonic can be used to restore your wallet. Keep it carefully to not lose your assets.": "",
|
||||
"I have saved my mnemonic seed safely.": "",
|
||||
"Next step": "",
|
||||
"Derivation Path": "",
|
||||
@ -46,9 +49,10 @@
|
||||
"Create a derived account": "",
|
||||
"Create account from new seed": "",
|
||||
"Export account": "",
|
||||
"You are exporting your account. Keep it safe and don't share it with anyone.": "",
|
||||
"You are exporting your account. Keep it safe and don't share it with anyone.": "",
|
||||
"password for this account": "",
|
||||
"I want to export this account": "",
|
||||
"Cancel": "",
|
||||
"Forget account": "",
|
||||
"You are about to remove the account. This means that you will not be able to access it via this extension anymore. If you wish to recover it, you would need to use the seed.": "",
|
||||
"I want to forget this account": "",
|
||||
@ -81,10 +85,10 @@
|
||||
"version": "",
|
||||
"nonce": "",
|
||||
"tip": "",
|
||||
"Transaction": "",
|
||||
"Sign message": "",
|
||||
"Sign the transaction": "",
|
||||
"Sign the message": "",
|
||||
"Transaction": "",
|
||||
"Sign message": "",
|
||||
"Scan signature via camera": "",
|
||||
"Don't ask me again for the next {{expiration}} minutes": "",
|
||||
"Password for this account": "",
|
||||
@ -94,8 +98,5 @@
|
||||
"We do not use any trackers or analytics": "",
|
||||
"We don't collect keys, addresses or any information - your information never leaves this machine": "",
|
||||
"... we are not in the information collection business (even anonymized).": "",
|
||||
"Understood, let me continue": "",
|
||||
"You currently don't have any accounts. Create your first account to get started.": "",
|
||||
"Please write down your wallet's mnemonic seed and keep it in a safe place. The mnemonic can be used to restore your wallet. Keep it carefully to not lose your assets.": "",
|
||||
"You are exporting your account. Keep it safe and don't share it with anyone.": ""
|
||||
"Understood, let me continue": ""
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user