Make new profile settings translatable

This commit is contained in:
Florian Dupret 2020-05-27 16:17:24 +02:00
parent a695a1bba2
commit f8963179c3
11 changed files with 22691 additions and 111 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5527
public/v1/js/profile.js vendored

File diff suppressed because one or more lines are too long

View File

@ -35,17 +35,17 @@
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
Authorized Applications
{{ $t('profile.authorized_apps') }}
</h3>
</div>
<div class="box-body">
<!-- Authorized Tokens -->
<table class="table table-borderless m-b-none">
<caption>Authorized clients</caption>
<caption>{{ $t('profile.authorized_clients') }}</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Scopes</th>
<th scope="col">{{ $t('firefly.name') }}</th>
<th scope="col">{{ $t('profile.scopes') }}</th>
<th scope="col"></th>
</tr>
</thead>
@ -67,7 +67,7 @@
<!-- Revoke Button -->
<td style="vertical-align: middle;">
<a class="action-link btn btn-danger btn-xs" @click="revoke(token)">
Revoke
{{ $t('profile.revoke') }}
</a>
</td>
</tr>

View File

@ -34,23 +34,23 @@
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
OAuth Clients
{{ $t('profile.oauth_clients') }}
</h3>
</div>
<div class="box-body">
<!-- Current Clients -->
<p class="m-b-none" v-if="clients.length === 0">
You have not created any OAuth clients.
{{ $t('profile.oauth_no_clients') }}
</p>
<table class="table table-borderless m-b-none" v-if="clients.length > 0">
<caption>Clients</caption>
<caption>{{ $t('profile.oauth_clients_header') }}</caption>
<thead>
<tr>
<th scope="col">Client ID</th>
<th scope="col">Name</th>
<th scope="col">Secret</th>
<th scope="col">{{ $t('profile.oauth_client_id') }}</th>
<th scope="col">{{ $t('firefly.name') }}</th>
<th scope="col">{{ $t('profile.oauth_client_secret') }}</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
@ -76,14 +76,14 @@
<!-- Edit Button -->
<td style="vertical-align: middle;">
<a class="action-link btn btn-default btn-xs" @click="edit(client)">
Edit
{{ $t('firefly.edit') }}
</a>
</td>
<!-- Delete Button -->
<td style="vertical-align: middle;">
<a class="action-link btn btn-danger btn-xs" @click="destroy(client)">
Delete
{{ $t('firefly.delete') }}
</a>
</td>
</tr>
@ -92,7 +92,7 @@
</div>
<div class="box-footer">
<a class="action-link btn btn-success" @click="showCreateClientForm">
Create New Client
{{ $t('profile.oauth_create_new_client') }}
</a>
</div>
</div>
@ -105,14 +105,14 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Create Client
{{ $t('profile.oauth_create_client') }}
</h4>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger" v-if="createForm.errors.length > 0">
<p><strong>Whoops!</strong> Something went wrong!</p>
<p><strong>{{ $t('firefly.whoops') }}</strong> {{ $t('firefly.something_wrong') }}</p>
<br>
<ul>
<li v-for="error in createForm.errors">
@ -125,28 +125,28 @@
<form class="form-horizontal" role="form">
<!-- Name -->
<div class="form-group">
<label class="col-md-3 control-label">Name</label>
<label class="col-md-3 control-label">{{ $t('firefly.name') }}</label>
<div class="col-md-7">
<input id="create-client-name" type="text" class="form-control"
@keyup.enter="store" v-model="createForm.name">
<span class="help-block">
Something your users will recognize and trust.
{{ $t('profile.oauth_name_help') }}
</span>
</div>
</div>
<!-- Redirect URL -->
<div class="form-group">
<label class="col-md-3 control-label">Redirect URL</label>
<label class="col-md-3 control-label">{{ $t('profile.oauth_redirect_url') }}</label>
<div class="col-md-7">
<input type="text" class="form-control" name="redirect"
@keyup.enter="store" v-model="createForm.redirect">
<span class="help-block">
Your application's authorization callback URL.
{{ $t('profile.oauth_redirect_url_help') }}
</span>
</div>
</div>
@ -155,10 +155,10 @@
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ $t('firefly.close') }}</button>
<button type="button" class="btn btn-primary" @click="store">
Create
{{ $t('firefly.create') }}
</button>
</div>
</div>
@ -173,14 +173,14 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Edit Client
{{ $t('profile.oauth_edit_client') }}
</h4>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger" v-if="editForm.errors.length > 0">
<p><strong>Whoops!</strong> Something went wrong!</p>
<p><strong>{{ $t('firefly.whoops') }}</strong> {{ $t('firefly.something_wrong') }}</p>
<br>
<ul>
<li v-for="error in editForm.errors">
@ -193,28 +193,28 @@
<form class="form-horizontal" role="form">
<!-- Name -->
<div class="form-group">
<label class="col-md-3 control-label">Name</label>
<label class="col-md-3 control-label">{{ $t('firefly.name') }}</label>
<div class="col-md-7">
<input id="edit-client-name" type="text" class="form-control"
@keyup.enter="update" v-model="editForm.name">
<span class="help-block">
Something your users will recognize and trust.
{{ $t('profile.oauth_name_help') }}
</span>
</div>
</div>
<!-- Redirect URL -->
<div class="form-group">
<label class="col-md-3 control-label">Redirect URL</label>
<label class="col-md-3 control-label">{{ $t('profile.oauth_redirect_url') }}</label>
<div class="col-md-7">
<input type="text" class="form-control" name="redirect"
@keyup.enter="update" v-model="editForm.redirect">
<span class="help-block">
Your application's authorization callback URL.
{{ $t('profile.oauth_redirect_url_help') }}
</span>
</div>
</div>
@ -223,10 +223,10 @@
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ $t('firefly.close') }}</button>
<button type="button" class="btn btn-primary" @click="update">
Save Changes
{{ $t('firefly.save_changes') }}
</button>
</div>
</div>
@ -356,7 +356,7 @@
if (typeof error.response.data === 'object') {
form.errors = _.flatten(_.toArray(error.response.data));
} else {
form.errors = ['Something went wrong. Please try again.'];
form.errors = [$t('firefly.try_again')];
}
});
},

View File

@ -34,21 +34,21 @@
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
Personal Access Tokens
{{ $t('profile.personal_access_tokens') }}
</h3>
</div>
<div class="box-body">
<!-- No Tokens Notice -->
<p class="m-b-none" v-if="tokens.length === 0">
You have not created any personal access tokens.
{{ $t('profile.no_personal_access_token') }}
</p>
<!-- Personal Access Tokens -->
<table class="table table-borderless m-b-none" v-if="tokens.length > 0">
<caption>Personal Access Tokens</caption>
<caption>{{ $t('profile.personal_access_tokens') }}</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">{{ $t('firefly.name') }}</th>
<th scope="col"></th>
</tr>
</thead>
@ -63,7 +63,7 @@
<!-- Delete Button -->
<td style="vertical-align: middle;">
<a class="action-link text-danger" @click="revoke(token)">
Delete
{{ $t('firefly.delete') }}
</a>
</td>
</tr>
@ -72,7 +72,7 @@
</div>
<div class="box-footer">
<a class="action-link btn btn-success" @click="showCreateTokenForm">
Create New Token
{{ $t('profile.create_new_token') }}
</a>
</div>
</div>
@ -86,14 +86,14 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Create Token
{{ $t('profile.create_token') }}
</h4>
</div>
<div class="modal-body">
<!-- Form Errors -->
<div class="alert alert-danger" v-if="form.errors.length > 0">
<p><strong>Whoops!</strong> Something went wrong!</p>
<p><strong>{{ $t('firefly.whoops') }}</strong> {{ $t('firefly.something_wrong') }}</p>
<br>
<ul>
<li v-for="error in form.errors">
@ -106,7 +106,7 @@
<form class="form-horizontal" role="form" @submit.prevent="store">
<!-- Name -->
<div class="form-group">
<label class="col-md-4 control-label">Name</label>
<label class="col-md-4 control-label">{{ $t('firefly.name') }}</label>
<div class="col-md-6">
<input id="create-token-name" type="text" class="form-control" name="name" v-model="form.name">
@ -115,7 +115,7 @@
<!-- Scopes -->
<div class="form-group" v-if="scopes.length > 0">
<label class="col-md-4 control-label">Scopes</label>
<label class="col-md-4 control-label">{{ $t('profile.scopes') }}</label>
<div class="col-md-6">
<div v-for="scope in scopes">
@ -136,10 +136,10 @@
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ $t('firefly.close') }}</button>
<button type="button" class="btn btn-primary" @click="store">
Create
{{ $t('firefly.create') }}
</button>
</div>
</div>
@ -154,21 +154,20 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
Personal Access Token
{{ $t('profile.personal_access_token') }}
</h4>
</div>
<div class="modal-body">
<p>
Here is your new personal access token. This is the only time it will be shown so don't lose it!
You may now use this token to make API requests.
{{ $t('profile.personal_access_token_explanation') }}
</p>
<pre><textarea id="tokenHidden" style="width:100%;" rows="20" class="form-control">{{ accessToken }}</textarea></pre>
</div>
<!-- Modal Actions -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ $t('firefly.close') }}</button>
</div>
</div>
</div>
@ -272,7 +271,7 @@
if (typeof error.response.data === 'object') {
this.form.errors = _.flatten(_.toArray(error.response.data));
} else {
this.form.errors = ['Something went wrong. Please try again.'];
this.form.errors = [ $t('firefly.try_again') ];
}
});
},

View File

@ -64,35 +64,7 @@ Vue.component('account-select', AccountSelect);
Vue.component('create-transaction', CreateTransaction);
// Create VueI18n instance with options
const i18n = new vuei18n({
locale: document.documentElement.lang, // set locale
fallbackLocale: 'en',
messages: {
'cs': require('./locales/cs.json'),
'de': require('./locales/de.json'),
'en': require('./locales/en.json'),
'es': require('./locales/es.json'),
'el': require('./locales/el.json'),
'fr': require('./locales/fr.json'),
'hu': require('./locales/hu.json'),
'id': require('./locales/id.json'),
'it': require('./locales/it.json'),
'nl': require('./locales/nl.json'),
'no': require('./locales/no.json'),
'pl': require('./locales/pl.json'),
'fi': require('./locales/fi.json'),
'pt-br': require('./locales/pt-br.json'),
'ro': require('./locales/ro.json'),
'ru': require('./locales/ru.json'),
'zh': require('./locales/zh.json'),
'zh-tw': require('./locales/zh-tw.json'),
'zh-cn': require('./locales/zh-cn.json'),
'sv': require('./locales/sv.json'),
'vi': require('./locales/vi.json'),
}
});
const i18n = require('./i18n');
let props = {};
new Vue({

View File

@ -64,34 +64,7 @@ Vue.component('account-select', AccountSelect);
Vue.component('edit-transaction', EditTransaction);
// Create VueI18n instance with options
const i18n = new vuei18n({
locale: document.documentElement.lang, // set locale
fallbackLocale: 'en',
messages: {
'cs': require('./locales/cs.json'),
'de': require('./locales/de.json'),
'en': require('./locales/en.json'),
'es': require('./locales/es.json'),
'el': require('./locales/el.json'),
'fr': require('./locales/fr.json'),
'hu': require('./locales/hu.json'),
'id': require('./locales/id.json'),
'it': require('./locales/it.json'),
'nl': require('./locales/nl.json'),
'no': require('./locales/no.json'),
'pl': require('./locales/pl.json'),
'fi': require('./locales/fi.json'),
'pt-br': require('./locales/pt-br.json'),
'ro': require('./locales/ro.json'),
'ru': require('./locales/ru.json'),
'zh': require('./locales/zh.json'),
'zh-tw': require('./locales/zh-tw.json'),
'zh-cn': require('./locales/zh-cn.json'),
'sv': require('./locales/sv.json'),
'vi': require('./locales/vi.json'),
}
});
const i18n = require('./i18n');
let props = {};
new Vue({

28
resources/assets/js/i18n.js vendored Normal file
View File

@ -0,0 +1,28 @@
// Create VueI18n instance with options
module.exports = new vuei18n({
locale: document.documentElement.lang, // set locale
fallbackLocale: 'en',
messages: {
'cs': require('./locales/cs.json'),
'de': require('./locales/de.json'),
'en': require('./locales/en.json'),
'es': require('./locales/es.json'),
'el': require('./locales/el.json'),
'fr': require('./locales/fr.json'),
'hu': require('./locales/hu.json'),
'id': require('./locales/id.json'),
'it': require('./locales/it.json'),
'nl': require('./locales/nl.json'),
'no': require('./locales/no.json'),
'pl': require('./locales/pl.json'),
'fi': require('./locales/fi.json'),
'pt-br': require('./locales/pt-br.json'),
'ro': require('./locales/ro.json'),
'ru': require('./locales/ru.json'),
'zh': require('./locales/zh.json'),
'zh-tw': require('./locales/zh-tw.json'),
'zh-cn': require('./locales/zh-cn.json'),
'sv': require('./locales/sv.json'),
'vi': require('./locales/vi.json'),
}
});

View File

@ -3,7 +3,15 @@
"welcome_back": "What's playing?",
"flash_error": "Error!",
"flash_success": "Success!",
"create": "Create",
"edit": "Edit",
"delete": "Delete",
"save_changes": "Save Changes",
"name": "Name",
"close": "Close",
"whoops":" Whoops!",
"something_wrong": "Something went wrong!",
"try_again": "Something went wrong. Please try again.",
"split_transaction_title": "Description of the split transaction",
"errors_submission": "There was something wrong with your submission. Please check out the errors below.",
"split": "Split",
@ -51,5 +59,29 @@
},
"config": {
"html_language": "en"
},
"profile": {
"oauth_clients": "OAuth Clients",
"oauth_no_clients": "You have not created any OAuth clients.",
"oauth_clients_header": "Clients",
"oauth_client_id": "Client ID",
"oauth_client_name": "Name",
"oauth_client_secret": "Secret",
"oauth_create_new_client": "Create New Client",
"oauth_create_client": "Create Client",
"oauth_edit_client": "Edit Client",
"oauth_name_help": "Something your users will recognize and trust.",
"oauth_redirect_url": "Redirect URL",
"oauth_redirect_url_help": "Your application's authorization callback URL.",
"authorized_apps": "Authorized Applications",
"authorized_clients": "Authorized clients",
"scopes": "Scopes",
"revoke": "Revoke",
"personal_access_tokens": "Personal Access Tokens",
"personal_access_token": "Personal Access Token",
"personal_access_token_explanation": "Here is your new personal access token. This is the only time it will be shown so don't lose it! You may now use this token to make API requests.",
"no_personal_access_token" : "You have not created any personal access tokens.",
"create_new_token": "Create New Token",
"create_token": "Create Token"
}
}

View File

@ -37,8 +37,11 @@ Vue.component('passport-personal-access-tokens', PersonalAccessTokens);
Vue.component('profile-options', ProfileOptions);
const i18n = require('./i18n');
let props = {};
new Vue({
i18n,
el: "#passport_clients",
render: (createElement) => {
return createElement(ProfileOptions, { props: props })