Skip to content

Commit

Permalink
Language mapping completed, now ready for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
joemarct committed Dec 15, 2017
1 parent 1347a44 commit 03e76e9
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 53 deletions.
15 changes: 11 additions & 4 deletions venue/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ def get_queryset(self):
class SignatureSerializer(serializers.ModelSerializer):
user_ranks = serializers.StringRelatedField(many=True)
verification_code = serializers.CharField(max_length=10, required=False)
forum_site_name = serializers.CharField(max_length=30, required=False)
forum_userid = serializers.CharField(max_length=20, required=False)
forum_user_name = serializers.CharField(max_length=30, required=False)

class Meta:
model = Signature
fields = ('id', 'name', 'forum_site', 'user_ranks', 'code',
'image', 'active', 'verification_code')
'image', 'active', 'verification_code', 'forum_site_name',
'forum_userid', 'forum_user_name')

def inject_verification_code(sig_code, verification_code):
def repl(m):
Expand All @@ -94,10 +98,13 @@ def get_queryset(self):
verified=True)
my_sigs = []
for fp in my_fps:
args = (fp.forum.name, fp.forum_username, fp.forum_user_id)
name = 'Forum site: %s / Username: %s / User ID: %s' % args
#args = (fp.forum.name, fp.forum_username, fp.forum_user_id)
#name = 'Forum site: %s / Username: %s / User ID: %s' % args
#sig.name = name
sig = fp.signature
sig.name = name
sig.forum_site_name = fp.forum.name
sig.forum_user_name = fp.forum_username
sig.forum_userid = fp.forum_user_id
sig.verification_code = fp.verification_code
my_sigs.append(sig)
return my_sigs
Expand Down
2 changes: 1 addition & 1 deletion venue_app/src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default {
{key: 'influencePoints', sortable: true, label: this.$t('influence_points')},
{key: 'totalPoints', sortable: true, label: this.$t('total_points')},
{key: 'VTX_Tokens', sortable: true, label: this.$t('vtx_tokens')},
'show_details'
{key: 'show_details', label: this.$t('show_details')}
],
stats: {},
refreshing: false
Expand Down
7 changes: 6 additions & 1 deletion venue_app/src/components/DashboardVisuals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@
<b-row style="margin-top: 40px;">
<b-col>
<p style="text-align: center;"><strong>{{ $t('daily_posts_and_ranking') }}</strong></p>
<points-evolution-chart :data="userstats.daily_stats" :height="200"></points-evolution-chart>
<points-evolution-chart
:data="userstats.daily_stats"
:y1label="$t('number_new_posts')"
:y2label="$t('ranking')"
:height="200">
</points-evolution-chart>
</b-col>
</b-row>
</b-col>
Expand Down
10 changes: 1 addition & 9 deletions venue_app/src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ export default {
return {
showPage: false,
language: this.$store.state.language,
languages: [
{value: 'en', text: 'English'},
{value: 'fr', text: 'French'},
{value: 'jp', text: 'Japanese'}
]
languages: this.$store.state.languages
}
},
watch: {
Expand Down Expand Up @@ -157,11 +153,7 @@ export default {
})
},
updated () {
console.log(document.body.offsetHeight)
console.log(window.innerHeight)
this.$nextTick(function () {
console.log(document.body.offsetHeight)
console.log(window.innerHeight)
if (document.body.offsetHeight <= window.innerHeight) {
this.$store.commit('updateShowFooter', true)
} else {
Expand Down
16 changes: 11 additions & 5 deletions venue_app/src/components/Signatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<h2>{{ $t('signatures') }}</h2>
</b-col>
<b-col v-if="!showAddForm" style="text-align: right;">
<b-button variant="primary" @click="addNewSignature(true)">Add New</b-button>
<b-button variant="primary" @click="addNewSignature(true)">
{{ $t('add_new') }}
</b-button>
</b-col>
<b-col v-if="showAddForm" v-show="mySignatures.length > 0" style="text-align: right;">
<b-button @click="addNewSignature(false)">
Expand Down Expand Up @@ -105,14 +107,18 @@
img-alt="Signature"
img-bottom>
<b-row style="margin: 0; padding: 0;">
<b-col style="margin: 0; padding: 0;">
<b-col sm="9" style="margin: 0; padding: 0;">
<p class="card-text">
{{ signature.name }}
{{ $t('forum_site') }}: {{ signature.forum_site_name }} /
{{ $t('username') }}: {{ signature.forum_user_name }} /
{{ $t('user_id') }}: {{ signature.forum_userid }}
</p>
</b-col>
<b-col style="margin: 0; padding: 0;">
<b-col sm="3" style="margin: 0; padding: 0;">
<p style="text-align: right; cursor: pointer;">
<span @click="showSignatureCode(signature.verification_code)">Show Code</span>
<span @click="showSignatureCode(signature.verification_code)">
{{ $t('show_code') }}
</span>
</p>
</b-col>
</b-row>
Expand Down
19 changes: 14 additions & 5 deletions venue_app/src/components/TopNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

<b-navbar-nav class="ml-auto">

<b-nav-item-dropdown v-if="!$store.state.apiToken" :text="$i18n.t('language')" right>
<b-dropdown-item @click="setLanguage('en')">English</b-dropdown-item>
<b-dropdown-item @click="setLanguage('fr')">French</b-dropdown-item>
<b-dropdown-item @click="setLanguage('jp')">Japanese</b-dropdown-item>
<b-nav-item-dropdown v-if="!$store.state.apiToken" :text="$t('language')" right>
<b-dropdown-item
v-for="lang in languages" :key="lang.value"
@click="setLanguage(lang.value)">
{{ lang.text }}
</b-dropdown-item>
</b-nav-item-dropdown>

<b-nav-item v-if="$store.state.apiToken" to="/dashboard" exact>
Expand All @@ -37,7 +39,7 @@
<b-nav-item v-if="$store.state.apiToken" to="/signatures">
{{ $t('signatures') }}
</b-nav-item>

<b-nav-item-dropdown right v-if="$store.state.apiToken">
<template slot="button-content">
{{ username }}
Expand All @@ -63,6 +65,11 @@ import axios from 'axios'
export default {
name: 'TopNavigation',
components: { LoginModal, ResetPasswordModal },
data () {
return {
languages: this.$store.state.languages
}
},
methods: {
logout () {
this.$store.commit('updateApiToken', '')
Expand Down Expand Up @@ -92,6 +99,8 @@ export default {
}).then(response => {
if (response.data.found === true) {
this.setUser(response.data)
// Localize to selected language
this.$i18n.locale = this.$store.state.language
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions venue_app/src/components/charts/PointsEvolutionChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Line, mixins } from 'vue-chartjs'
export default {
extends: Line,
mixins: [mixins.reactiveProp],
props: ['data'],
props: ['data', 'y1label', 'y2label'],
mounted () {
let dates = this.data.map(function (value, index) {
return value.date
Expand Down Expand Up @@ -48,7 +48,7 @@ export default {
scaleLabel: {
display: true,
fontColor: '#dd4c3d',
labelString: 'Number of New Posts'
labelString: this.y1label // 'Number of New Posts'
}
}, {
id: 'B',
Expand All @@ -62,7 +62,7 @@ export default {
scaleLabel: {
display: true,
fontColor: '#2e3847',
labelString: 'Ranking'
labelString: this.y2label
}
}]
}
Expand Down
2 changes: 1 addition & 1 deletion venue_app/src/components/modals/LoginModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</b-form>
<div slot="modal-footer" class="w-100">
<p class="float-left" v-if="!resetPassswordMessage">
<a @click="togglePasswordResetForm()" href="#">Forgot password?</a>
<a @click="togglePasswordResetForm()" href="#">{{ $t('forgot_password') }}</a>
</p>
<b-alert v-if="resetPassswordMessage" show>{{ resetPassswordMessage }}</b-alert>
<b-input-group v-if="showPasswordResetForm">
Expand Down
4 changes: 4 additions & 0 deletions venue_app/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default new Vuex.Store({
userName: null,
userEmail: null,
language: 'en',
languages: [
{value: 'en', text: 'English'},
{value: 'jp', text: 'Japanese'}
],
showLoginForm: false,
showFooter: false
},
Expand Down
40 changes: 17 additions & 23 deletions venue_app/src/translations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const messages = {
'username': 'Username',
'assign_username': 'Assign a username',
'rank': 'Rank',
'ranking': 'Ranking',
'your_rank': 'Your Rank',
'total_posts': 'Total Posts',
'your_total_posts': 'Your Total Posts',
Expand All @@ -29,6 +30,7 @@ const messages = {
'email': 'Email',
'email_address': 'Email Address',
'account_username': 'Account Username',
'forgot_password': 'Forgot password?',
'username_or_email': 'Username or Email',
'password': 'Password',
'enter_username': 'Enter username',
Expand Down Expand Up @@ -72,7 +74,7 @@ const messages = {
'delete': 'Delete',
'yes': 'Yes',
'ok': 'OK',
'faq': 'Frequently Asked Questions (FAQs)',
'faq': 'Frequently Asked Questions',
'latest_check_negative': 'The latest check did not find our signature in your profile.',
'change_email_form': 'Change Email Form',
'change_username_form': 'Change Username Form',
Expand Down Expand Up @@ -132,26 +134,12 @@ const messages = {
'join_or_login': 'Join the signature campaign now or login!',
'tokens_available': 'Total Tokens Available',
'points_available': 'Total Points Available',
'daily_posts_and_ranking': 'Daily Posts and Ranking'
},
'fr': {
'username': "Nom d'utilisateur",
'enter_username': "Entrez le nom d'utilisateur",
'password': 'Mot de passe',
'enter_password': 'Entrer le mot de passe',
'login_error': "Le nom d'utilisateur ou le mot de passe que vous avez entré était erroné!",
'language': 'La langue',
'signup': "S'inscrire",
'login': 'Se Connecter',
'logout': 'Déconnecter',
'venue_title': 'Suivi de la campagne de signature autonome',
'venue_description': "VENUE suit et affiche des classements d'utilisateurs sophistiqués et des informations de paiement précises en direct.",
'dashboard': 'Tableau de Bord',
'signatures': 'Signatures',
'settings': 'Paramètres',
'sign_up_form': "Formulaire d'inscription",
'login_form': 'Formulaire de connexion',
'submit': 'Soumettre'
'daily_posts_and_ranking': 'Daily Posts and Ranking',
'show_details': 'Show Details',
'show_code': 'Show Code',
'add_new': 'Add New',
'number_new_posts': 'Number of New Posts'

},
'jp': {
'account_deleted': 'アカウントが削除されました!',
Expand Down Expand Up @@ -202,7 +190,8 @@ const messages = {
'enter_password': 'パスワードを入力する',
'enter_username': 'ユーザーネームを入力してください',
'enter_username_or_email': 'ユーザー名または電子メールを入力',
'faq': 'よくある質問(FAQ)',
'forgot_password': 'パスワードをお忘れですか?',
'faq': 'よくある質問',
'first_confirmation': '最初の確認',
'first_confirmation_msg': 'アカウントを削除してもよろしいですか?',
'forum_site': 'フォーラムサイト',
Expand Down Expand Up @@ -234,6 +223,7 @@ const messages = {
'profile_already_exists_msg2': '他の誰かが既にそのプロフィールを主張していました。',
'profile_details': 'プロフィールの詳細',
'rank': 'ランク',
'ranking': 'ランキング',
'refresh': 'リフレッシュ',
'retype_password': 'パスワードを再入力してください',
'retyped_password': '再入力されたパスワード',
Expand Down Expand Up @@ -286,7 +276,11 @@ const messages = {
'your_points_overview': 'あなたの現在のポイントの概要',
'your_rank': 'あなたのランク',
'your_total_points': 'あなたの合計ポイント',
'your_total_posts': 'あなたの総投稿数'
'your_total_posts': 'あなたの総投稿数',
'show_details': '詳細を表示',
'show_code': 'コードを表示する',
'add_new': '新しく追加する',
'number_new_posts': '新しい投稿の数'
}
}

Expand Down
2 changes: 1 addition & 1 deletion volentix/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SECRET_KEY = 'a85zgf@jc^_!8jcu-(j9l7p5z%ck+rwhceff2=@(n8o00%j2%o'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True

ALLOWED_HOSTS = ['localhost', 'venue.volentix.com']

Expand Down

0 comments on commit 03e76e9

Please sign in to comment.