1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

[WIP] adding localisation support for French

This commit is contained in:
Sylvain Bellemare 2015-07-01 18:58:13 +02:00
parent ce5b9231af
commit 3eedda7724
9 changed files with 229 additions and 61 deletions

View File

@ -54,7 +54,7 @@ let AccordionListItem = React.createClass({
<div>
<span>{this.props.content.date_created.split('-')[0]}</span>
<a href={this.props.content.license_type.url} target="_blank" className="pull-right">
{this.props.content.license_type.code} license
{getLangText('%s license', this.props.content.license_type.code)}
</a>
</div>
</div>

View File

@ -6,8 +6,10 @@ import ReactAddons from 'react/addons';
import Button from 'react-bootstrap/lib/Button';
import requests from '../../utils/requests';
import { getLangText } from '../../utils/lang_utils';
import AlertDismissable from './alert';
let Form = React.createClass({
propTypes: {
url: React.PropTypes.string,
@ -85,7 +87,7 @@ let Form = React.createClass({
}
}
else {
this.setState({errors: ['Something went wrong, please try again later']});
this.setState({errors: [getLangText('Something went wrong, please try again later')]});
}
this.setState({submitted: false});
},

View File

@ -11,6 +11,7 @@ import Property from './ascribe_forms/property';
import InputTextAreaToggable from './ascribe_forms/input_textarea_toggable';
import apiUrls from '../constants/api_urls';
import { getLangText } from '../utils/lang_utils';
let CoaVerifyContainer = React.createClass({

View File

@ -95,8 +95,8 @@ let Header = React.createClass({
collection = <NavItemLink to="pieces">COLLECTION</NavItemLink>;
}
else {
account = <NavItemLink to="login">LOGIN</NavItemLink>;
signup = <NavItemLink to="signup">SIGNUP</NavItemLink>;
account = <NavItemLink to="login">{getLangText('LOGIN')}</NavItemLink>;
signup = <NavItemLink to="signup">{getLangText('SIGNUP')}</NavItemLink>;
}
return (

View File

@ -15,6 +15,8 @@ import Property from './ascribe_forms/property';
import apiUrls from '../constants/api_urls';
import AppConstants from '../constants/application_constants';
import { getLangText } from '../utils/lang_utils';
let Link = Router.Link;
let LoginContainer = React.createClass({
@ -28,7 +30,7 @@ let LoginContainer = React.createClass({
getDefaultProps() {
return {
message: 'Log in to ascribe...',
message: getLangText('Log in to') + ' ascribe ...'
redirectOnLoggedIn: true,
redirectOnLoginSuccess: true
};
@ -107,7 +109,7 @@ let LoginForm = React.createClass({
<button
type="submit"
className="btn ascribe-btn ascribe-btn-login">
Log in to ascribe
{getLangText('Log in to')} ascribe
</button>}
spinner={
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
@ -116,28 +118,28 @@ let LoginForm = React.createClass({
}>
<Property
name='email'
label="Email">
label={getLangText('Email')}>
<input
type="email"
placeholder="Enter your email"
placeholder={getLangText('Enter your email')}
autoComplete="on"
name="username"
required/>
</Property>
<Property
name='password'
label="Password">
label={getLangText('Password')}>
<input
type="password"
placeholder="Enter your password"
placeholder={getLangText('Enter your password')}
autoComplete="on"
name="password"
required/>
</Property>
<hr />
<div className="ascribe-login-text">
Not an ascribe user&#63; <Link to="signup">Sign up...</Link><br/>
Forgot my password&#63; <Link to="password_reset">Rescue me...</Link>
{getLangText('Not an ascribe user')}&#63; <Link to="signup">{getLangText('Sign up')}...</Link><br/>
{getLangText('Forgot my password')}&#63; <Link to="password_reset">{getLangText('Rescue me')}...</Link>
</div>
</Form>
);

View File

@ -10,6 +10,8 @@ import apiUrls from '../constants/api_urls';
import GlobalNotificationModel from '../models/global_notification_model';
import GlobalNotificationActions from '../actions/global_notification_actions';
import { getLangText } from '../utils/lang_utils';
let PasswordResetContainer = React.createClass({
mixins: [Router.Navigation],
@ -24,7 +26,7 @@ let PasswordResetContainer = React.createClass({
return (
<div>
<div className="ascribe-login-text ascribe-login-header">
Reset the password for {this.props.query.email}
{getLangText('Reset the password for')} {this.props.query.email}
</div>
<PasswordResetForm
email={this.props.query.email}
@ -37,7 +39,7 @@ let PasswordResetContainer = React.createClass({
return (
<div>
<div className="ascribe-login-text ascribe-login-header">
Reset your ascribe password
{getLangText('Reset your ascribe password')}
</div>
<PasswordRequestResetForm
handleRequestSuccess={this.handleRequestSuccess}/>
@ -48,7 +50,7 @@ let PasswordResetContainer = React.createClass({
return (
<div>
<div className="ascribe-login-text ascribe-login-header">
An email has been sent to "{this.state.isRequested}"
{getLangText('An email has been sent to')} "{this.state.isRequested}"
</div>
</div>
);
@ -62,7 +64,7 @@ let PasswordResetContainer = React.createClass({
let PasswordRequestResetForm = React.createClass({
handleSuccess() {
let notificationText = 'Request succesfully sent, check your email';
let notificationText = getLangText('Request successfully sent, check your email');
let notification = new GlobalNotificationModel(notificationText, 'success', 50000);
GlobalNotificationActions.appendGlobalNotification(notification);
this.props.handleRequestSuccess(this.refs.form.refs.email.state.value);
@ -77,7 +79,7 @@ let PasswordRequestResetForm = React.createClass({
<button
type="submit"
className="btn ascribe-btn ascribe-btn-login">
Reset your password
{getLangText('Reset your password')}
</button>}
spinner={
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
@ -86,10 +88,10 @@ let PasswordRequestResetForm = React.createClass({
}>
<Property
name='email'
label="Email">
label={getLangText('Email')}>
<input
type="email"
placeholder="Enter your email and we'll send a link"
placeholder={getLangText("Enter your email and we'll send a link")}
name="email"
required/>
</Property>
@ -113,7 +115,7 @@ let PasswordResetForm = React.createClass({
},
handleSuccess() {
this.transitionTo('pieces');
let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000);
let notification = new GlobalNotificationModel(getLangText('password successfully updated'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() {
@ -127,7 +129,7 @@ let PasswordResetForm = React.createClass({
<button
type="submit"
className="btn ascribe-btn ascribe-btn-login">
Reset your password
{getLangText('Reset your password')}
</button>}
spinner={
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
@ -136,19 +138,19 @@ let PasswordResetForm = React.createClass({
}>
<Property
name='password'
label="Password">
label={getLangText('Password')}>
<input
type="password"
placeholder="Enter a new password"
placeholder={getLangText('Enter a new password')}
name="password"
required/>
</Property>
<Property
name='password_confirm'
label="Confirm password">
label={getLangText('Confirm password')}>
<input
type="password"
placeholder="Enter your password once again"
placeholder={getLangText('Enter your password once again')}
name="password"
required/>
</Property>

View File

@ -23,6 +23,7 @@ import Property from './ascribe_forms/property';
import apiUrls from '../constants/api_urls';
import AppConstants from '../constants/application_constants';
import { getLangText } from '../utils/lang_utils';
import { getCookie } from '../utils/fetch_api_utils';
@ -64,7 +65,7 @@ let AccountSettings = React.createClass({
handleSuccess(){
UserActions.fetchCurrentUser();
let notification = new GlobalNotificationModel('username succesfully updated', 'success', 5000);
let notification = new GlobalNotificationModel(getLangText('username succesfully updated'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() {
@ -76,21 +77,21 @@ let AccountSettings = React.createClass({
handleSuccess={this.handleSuccess}>
<Property
name='username'
label="Username">
label={getLangText('Username')}>
<input
type="text"
defaultValue={this.state.currentUser.username}
placeholder="Enter your username"
placeholder={getLangText('Enter your username')}
required/>
</Property>
<Property
name='email'
label="Email"
label={getLangText('Email')}
editable={false}>
<input
type="text"
defaultValue={this.state.currentUser.email}
placeholder="Enter your username"
placeholder={getLangText('Enter your username')}
required/>
</Property>
<hr />
@ -99,7 +100,7 @@ let AccountSettings = React.createClass({
}
return (
<CollapsibleParagraph
title="Account"
title={getLangText('Account')}
show={true}
defaultExpanded={true}>
{content}
@ -107,7 +108,7 @@ let AccountSettings = React.createClass({
url={AppConstants.serverUrl + 'api/users/set_language/'}>
<Property
name='language'
label="Choose your Language"
label={getLangText('Choose your Language')}
editable={true}>
<select id="select-lang" name="language">
<option value="fr">
@ -154,13 +155,13 @@ let BitcoinWalletSettings = React.createClass({
<Form >
<Property
name='btc_public_key'
label="Bitcoin public key"
label={getLangText('Bitcoin public key')}
editable={false}>
<pre className="ascribe-pre">{this.state.walletSettings.btc_public_key}</pre>
</Property>
<Property
name='btc_root_address'
label="Root Address"
label={getLangText('Root Address')}
editable={false}>
<pre className="ascribe-pre">{this.state.walletSettings.btc_root_address}</pre>
</Property>
@ -169,7 +170,7 @@ let BitcoinWalletSettings = React.createClass({
}
return (
<CollapsibleParagraph
title="Crypto Wallet"
title={getLangText('Crypto Wallet')}
show={true}
defaultExpanded={true}>
{content}
@ -266,14 +267,14 @@ let APISettings = React.createClass({
},
handleCreateSuccess: function(){
ApplicationActions.fetchApplication();
let notification = new GlobalNotificationModel('Application successfully created', 'success', 5000);
let notification = new GlobalNotificationModel(getLangText('Application successfully created'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
handleTokenRefresh: function(event){
let applicationName = event.target.getAttribute('data-id');
ApplicationActions.refreshApplicationToken(applicationName);
let notification = new GlobalNotificationModel('Token refreshed', 'success', 2000);
let notification = new GlobalNotificationModel(getLangText('Token refreshed'), 'success', 2000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() {
@ -293,7 +294,7 @@ let APISettings = React.createClass({
className="pull-right btn btn-default btn-sm"
onClick={this.handleTokenRefresh}
data-id={app.name}>
REFRESH
{getLangText('REFRESH')}
</button>
</div>
</div>
@ -309,7 +310,7 @@ let APISettings = React.createClass({
}
return (
<CollapsibleParagraph
title="API Integration"
title={getLangText('API Integration')}
show={true}
defaultExpanded={true}>
<Form
@ -317,10 +318,10 @@ let APISettings = React.createClass({
handleSuccess={this.handleCreateSuccess}>
<Property
name='name'
label='Application Name'>
label={getLangText('Application Name')}>
<input
type="text"
placeholder="Enter the name of your app"
placeholder={getLangText('Enter the name of your app')}
required/>
</Property>
<hr />

View File

@ -4,6 +4,7 @@ import React from 'react';
import Router from 'react-router';
import { mergeOptions } from '../utils/general_utils';
import { getLangText } from '../utils/lang_utils';
import UserStore from '../stores/user_store';
@ -66,7 +67,7 @@ let SignupContainer = React.createClass({
<div className="ascribe-login-wrapper">
<br/>
<div className="ascribe-login-text ascribe-login-header">
Welcome to ascribe...
{getLangText('Welcome to')} ascribe...
</div>
<SignupForm handleSuccess={this.handleSuccess}/>
</div>
@ -80,16 +81,17 @@ let SignupForm = React.createClass({
handleSuccess(response){
let notificationText = 'Sign up successful';
let notificationText = getLangText('Sign up successful');
let notification = new GlobalNotificationModel(notificationText, 'success', 50000);
GlobalNotificationActions.appendGlobalNotification(notification);
this.props.handleSuccess('We sent an email to your address ' + response.user.email + ', please confirm.');
this.props.handleSuccess(getLangText('We sent an email to your address') + ' ' + response.user.email +
', ' + getLangText('please confirm') + '.');
},
render() {
let tooltipPassword = 'Your password must be at least 10 characters.\n ' +
'This password is securing your digital property like a bank account.\n ' +
'Store it in a safe place!';
let tooltipPassword = getLangText('Your password must be at least 10 characters') + '.\n ' +
getLangText('This password is securing your digital property like a bank account') + '.\n ' +
getLangText('Store it in a safe place') + '!';
return (
<Form
ref='form'
@ -97,7 +99,7 @@ let SignupForm = React.createClass({
handleSuccess={this.handleSuccess}
buttons={
<button type="submit" className="btn ascribe-btn ascribe-btn-login">
Sign up to ascribe
{getLangText('Sign up to ascribe')}
</button>}
spinner={
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
@ -106,39 +108,39 @@ let SignupForm = React.createClass({
}>
<Property
name='email'
label="Email">
label={getLangText('Email')}>
<input
type="email"
placeholder="Enter your email"
placeholder={getLangText('Enter your email')}
autoComplete="on"
required/>
</Property>
<Property
name='password'
label="Password"
label={getLangText('Password')}
tooltip={tooltipPassword}>
<input
type="password"
placeholder="Enter your password"
placeholder={getLangText('Enter your password')}
autoComplete="on"
required/>
</Property>
<Property
name='password_confirm'
label="Confirm Password"
label={getLangText('Confirm Password')}
tooltip={tooltipPassword}>
<input
type="password"
placeholder="Enter your password once again"
placeholder={getLangText('Enter your password once again')}
autoComplete="on"
required/>
</Property>
<Property
name='promo_code'
label="Promocode">
label={getLangText('Promocode')}>
<input
type="text"
placeholder="Enter a promocode here (Optional)"/>
placeholder={getLangText('Enter a promocode here (Optional)')}/>
</Property>
<hr />
<InputCheckbox
@ -146,8 +148,8 @@ let SignupForm = React.createClass({
required="required"
label={
<div>
I agree to the&nbsp;
<a href="/terms" target="_blank"> Terms of Service</a>
{getLangText('I agree to the')}&nbsp;
<a href="/terms" target="_blank"> {getLangText('Terms of Service')}</a>
</div>}/>
</Form>
);

View File

@ -13,7 +13,55 @@ const languages = {
'Terms of Service': 'Terms of Service',
'Log out': 'Log out',
'Previous': 'Previous',
'Next': 'Next'
'Next': 'Next',
'%s license': '%s license',
'Log in to': 'Log in to',
'Email': 'Email',
'Enter your email': 'Enter your email',
'Password': 'Password',
'Enter your password': 'Enter your password',
'Not an ascribe user': 'Not an ascribe user',
'Sign up': 'Sign up',
'Forgot my password': 'Forgot my password',
'Rescue me': 'Rescue me',
'LOGIN': 'LOGIN',
'SIGNUP': 'SIGNUP',
'Welcome to': 'Welcome to',
'Sign up to ascribe': 'Sign up to ascribe',
'Enter your password once again': 'Enter your password once again',
'Enter a promocode here (Optional)': 'Enter a promocode here (Optional)',
'I agree to the': 'I agree to the',
'Confirm Password': 'Confirm Password',
'Promocode': 'Promocode',
'Sign up successful': 'Sign up successful',
'We sent an email to your address': 'We sent an email to your address',
'please confirm': 'please confirm',
'Your password must be at least 10 characters': 'Your password must be at least 10 characters',
'This password is securing your digital property like a bank account': 'This password is securing your digital property like a bank account',
'Store it in a safe place': 'Store it in a safe place',
'Reset the password for': 'Reset the password for',
'Reset your ascribe password': 'Reset your ascribe password',
'An email has been sent to': 'An email has been sent to',
'Request successfully sent, check your email': 'Request successfully sent, check your email',
'Reset your password': 'Reset your password',
'Enter your email and we\'ll send a link': 'Enter your email and we\'ll send a link',
'password successfully updated': 'password successfully updated',
'Enter a new password': 'Enter a new password',
'Something went wrong, please try again later': 'Something went wrong, please try again later',
'username succesfully updated': 'username succesfully updated',
'Username': 'Username',
'Enter your username': 'Enter your username',
'Choose your Language': 'Choose your Language',
'Bitcoin public key': 'Bitcoin public key',
'Root Address': 'Root Address',
'Crypto Wallet': 'Crypto Wallet',
'Application successfully created': 'Application successfully created',
'Token refreshed': 'Token refreshed',
'REFRESH': 'REFRESH',
'API Integration': 'API Integration',
'Application Name': 'Application Name',
'Enter the name of your app': 'Enter the name of your app',
'Account': 'Account'
},
'de': {
'ID': 'ID',
@ -27,7 +75,117 @@ const languages = {
'Terms of Service': 'AGB',
'Log out': 'Log out',
'Previous': 'Zurück',
'Next': 'Weiter'
'Next': 'Weiter',
'%s license': '%s license',
'Log in to': 'Log in to',
'Email': 'Email',
'Enter your email': 'Enter your email',
'Password': 'Password',
'Enter your password': 'Enter your password',
'Not an ascribe user': 'Not an ascribe user',
'Sign up': 'Sign up',
'Forgot my password': 'Forgot my password',
'Rescue me': 'Rescue me',
'LOGIN': 'LOGIN',
'SIGNUP': 'SIGNUP',
'Welcome to': 'Welcome to',
'Sign up to ascribe': 'Sign up to ascribe',
'Enter your password once again': 'Enter your password once again',
'Enter a promocode here (Optional)': 'Enter a promocode here (Optional)',
'I agree to the': 'I agree to the',
'Confirm Password': 'Confirm Password',
'Promocode': 'Promocode',
'Sign up successful': 'Sign up successful',
'We sent an email to your address': 'We sent an email to your address',
'please confirm': 'please confirm',
'Your password must be at least 10 characters': 'Your password must be at least 10 characters',
'This password is securing your digital property like a bank account': 'This password is securing your digital property like a bank account',
'Store it in a safe place': 'Store it in a safe place',
'Reset the password for': 'Reset the password for',
'Reset your ascribe password': 'Reset your ascribe password',
'An email has been sent to': 'An email has been sent to',
'Request successfully sent, check your email': 'Request successfully sent, check your email',
'Reset your password': 'Reset your password',
'Enter your email and we\'ll send a link': 'Enter your email and we\'ll send a link',
'password successfully updated': 'password successfully updated',
'Enter a new password': 'Enter a new password',
'Something went wrong, please try again later': 'Something went wrong, please try again later',
'username succesfully updated': 'username succesfully updated',
'Username': 'Username',
'Enter your username': 'Enter your username',
'Choose your Language': 'Choose your Language',
'Bitcoin public key': 'Bitcoin public key',
'Root Address': 'Root Address',
'Crypto Wallet': 'Crypto Wallet',
'Application successfully created': 'Application successfully created',
'Token refreshed': 'Token refreshed',
'REFRESH': 'REFRESH',
'API Integration': 'API Integration',
'Application Name': 'Application Name',
'Enter the name of your app': 'Enter the name of your app',
'Account': 'Account'
},
'fr': {
'ID': 'ID',
'Actions': 'Actions',
'Hide': 'Cacher',
'Show the edition': 'Montrer l\'Édition',
'Show all %d Editions': 'Montrer toutes les Éditions',
'by %s': 'by %s',
'Account Settings': 'Paramètres du compte',
'FAQ': 'FAQ',
'Terms of Service': 'Conditions d\'Utilisations',
'Log out': 'Quitter',
'Previous': 'Précédent',
'Next': 'Suivant',
'%s license': '%s license',
'Log in to': 'Se connecter à',
'Email': 'E-mail',
'Enter your email': 'Entrez votre e-mail',
'Password': 'Mot de passe',
'Enter your password': 'Entrez votre mot de passe',
'Not an ascribe user': 'Pas un utilisateur d\'ascribe',
'Sign up': 'Créer un compte',
'Forgot my password': 'J\'ai oublié mon mot de passe',
'Rescue me': 'Sauve-moi',
'LOGIN': 'SE CONNECTER',
'SIGNUP': 'CRÉER UN COMPTE',
'Welcome to': 'Bienvenue chez',
'Sign up to ascribe': 'S\'inscrire à ascribe',
'Enter your password once again': 'Entrez votre mot de passe une fois de plus',
'Enter a promocode here (Optional)': 'Entrez un code promotionnel ici (Facultatif)',
'I agree to the': 'Je suis d\'accrod avec les',
'Confirm Password': 'Confirmez le mot de passe',
'Promocode': 'Code promotionnel',
'Sign up successful': 'Inscription réussie',
'We sent an email to your address': 'Nous avons envoyé un e-mail à votre adresse',
'please confirm': 'veuillez confirmer',
'Your password must be at least 10 characters': 'Votre mot de passe doit être composé d\'au moins 10 caractères',
'This password is securing your digital property like a bank account': 'Ce mot de passe sécurise votre propriété numérique tel un compte bancaire',
'Store it in a safe place': 'Conservez-le dans un endroit sécuritaire',
'Reset the password for': 'Réinitialiser le mot de passe pour',
'Reset your ascribe password': 'Réinitialiser votre mot de passe ascribe',
'An email has been sent to': 'Un e-mail a été envoyé à',
'Request successfully sent, check your email': 'Requête envoyée avec succès, veuillez consultez votre courrier électronique',
'Reset your password': 'Réinitialiser votre mot de passe',
'Enter your email and we\'ll send a link': 'Entrez votre e-mail et nous vous enverrons un lien',
'password successfully updated': 'mise à jour du mot de passe réussie',
'Enter a new password': 'Entrez un nouveau mot de passe',
'Something went wrong, please try again later': 'Quelque chose ne fonctionne pas, veuillez réessayer plus tard',
'username succesfully updated': 'nom d\'utilisateur mis à jour avec succès',
'Username': 'Nom d\'utilisateur',
'Enter your username': 'Entrez votre nom d\'utilisateur',
'Choose your Language': 'Choisissez votre langue',
'Bitcoin public key': 'Clé publique Bitcoin',
'Root Address': 'Adresse Racine',
'Crypto Wallet': 'Porte-monnaie Crypto',
'Application successfully created': 'Application créée avec succès',
'Token refreshed': 'Jeton rafraîchi',
'REFRESH': 'RAFRAÎCHIR',
'API Integration': 'Intégration de l\'API',
'Application Name': 'Nom de l\'Application',
'Enter the name of your app': 'Entrez le nom de votre application',
'Account': 'Compte'
}
};