Commit 1db93f6f authored by ZeMKI's avatar ZeMKI
Browse files

Translations

* now the translations are fully programmed, a documentation file on office will explain how to add them.
parent 43ec1583
...@@ -39,7 +39,7 @@ Vue.config.debug = true; ...@@ -39,7 +39,7 @@ Vue.config.debug = true;
Vue.config.silent = false; Vue.config.silent = false;
Vue.prototype.trans = (key) => { Vue.prototype.trans = (key) => {
return _.findKey(window.trans,key)? window.trans[_.findKey(window.trans,key)][key] : key; return _.isUndefined(window.trans[key])? key : window.trans[key];
}; };
/** /**
......
<template> <template>
<section style="margin-left:auto;margin-right:auto;position: fixed;"> <section style="margin-left:auto;margin-right:auto;position: fixed;">
<button class="button is-danger" v-if="!loadingprogress > 0" id="downloadbutton" style="display: flex;z-index: 1000;margin: 5px;position: fixed;" @click="download" > export PDF</button> <button class="button is-danger" v-if="!loadingprogress > 0" id="downloadbutton" style="display: flex;z-index: 1000;margin: 5px;position: fixed;" @click="download" >{{ trans('export PDF') }}</button>
<img v-show="!loading" :src="screenshot" id="sorting" style="max-width: 100%;max-height: 100%;position:fixed;left:10%"> <img v-show="!loading" :src="screenshot" id="sorting" style="max-width: 100%;max-height: 100%;position:fixed;left:10%">
<div class="columns" style="top:50%;left: 50%;position: fixed;" :class="loading? 'columns loading' : 'columns'"></div> <div class="columns" style="top:50%;left: 50%;position: fixed;" :class="loading? 'columns loading' : 'columns'"></div>
<div id="bottom" v-show="!loading" style="display: flex;z-index: 1000;margin: 5px;position: fixed;bottom:0px;width:100%;background-color:#e9e7e3;display: inline;"> <div id="bottom" v-show="!loading" style="display: flex;z-index: 1000;margin: 5px;position: fixed;bottom:0px;width:100%;background-color:#e9e7e3;display: inline;">
......
...@@ -17,20 +17,20 @@ ...@@ -17,20 +17,20 @@
{{ props.row.id }} {{ props.row.id }}
</b-table-column> </b-table-column>
<b-table-column field="email" label="Author" sortable> <b-table-column field="email" :label="trans('Author')" sortable>
{{ props.row.author }} {{ props.row.author }}
</b-table-column> </b-table-column>
<b-table-column field="name" label="Interviewee" sortable> <b-table-column field="name" :label="trans('Interviewee')" sortable>
{{ props.row.interviewed }} {{ props.row.interviewed }}
</b-table-column> </b-table-column>
<b-table-column field="date" label="Start" centered sortable> <b-table-column field="date" :label="trans('Start')" centered sortable>
<span class="tag is-success"> <span class="tag is-success">
{{ formatdate(props.row.start) }} {{ formatdate(props.row.start) }}
</span> </span>
</b-table-column> </b-table-column>
<b-table-column field="date" label="End" centered sortable> <b-table-column field="date" :label="trans('End')" centered sortable>
<span class="tag is-success"> <span class="tag is-success">
{{ formatdate(props.row.end) }} {{ formatdate(props.row.end) }}
</span> </span>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<template slot="empty"> <template slot="empty">
<section class="section"> <section class="section">
<div class="content has-text-grey has-text-centered"> <div class="content has-text-grey has-text-centered">
<p>No interviews.</p> <p>{{ trans('No interviews.') }}</p>
</div> </div>
</section> </section>
</template> </template>
......
...@@ -19,11 +19,10 @@ ...@@ -19,11 +19,10 @@
<a class="button navigation-question-next" <a class="button navigation-question-next"
@click="interview.presortindex++" @click="interview.presortindex++"
:disabled="questions.presort.length == interview.presortindex-1" :disabled="questions.presort.length == interview.presortindex-1"
v-show="interview.presortindex < questions.presort.length-1"> Next Question v-show="interview.presortindex < questions.presort.length-1"> {{ trans('Next Question') }} > </a>
> </a>
<a class="button navigation-question-previous" <a class="button navigation-question-previous"
@click="interview.presortindex--" :disabled="interview.presortindex == 0" @click="interview.presortindex--" :disabled="interview.presortindex == 0"
v-show="interview.presortindex > 0"> < Previous Question </a> v-show="interview.presortindex > 0"> < {{ trans('Previous Question') }} </a>
<div class="control" v-if="a.type =='open'"> <div class="control" v-if="a.type =='open'">
<textarea class="textarea is-large" type="text" placeholder="OPEN ANSWER" <textarea class="textarea is-large" type="text" placeholder="OPEN ANSWER"
v-model="results[x.answer.ids[answerindex]]"> v-model="results[x.answer.ids[answerindex]]">
...@@ -116,10 +115,10 @@ ...@@ -116,10 +115,10 @@
<a class="button navigation-question-next" <a class="button navigation-question-next"
@click="interview.postsortindex++" @click="interview.postsortindex++"
:disabled="questions.postsort.length == interview.postsortindex-1" :disabled="questions.postsort.length == interview.postsortindex-1"
v-show="interview.postsortindex < questions.postsort.length-1"> Next Question > </a> v-show="interview.postsortindex < questions.postsort.length-1"> {{ trans('Next Question') }} ></a>
<a class="button navigation-question-previous " <a class="button navigation-question-previous "
@click="interview.postsortindex--" :disabled="interview.postsortindex == 0" @click="interview.postsortindex--" :disabled="interview.postsortindex == 0"
v-show="interview.postsortindex > 0"> < Previous Question </a> v-show="interview.postsortindex > 0"> < {{ trans('Previous Question') }} </a>
<div class="control" v-if="a.type =='open'"> <div class="control" v-if="a.type =='open'">
<textarea class="textarea is-large" type="text" placeholder="OPEN ANSWER" <textarea class="textarea is-large" type="text" placeholder="OPEN ANSWER"
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<div class="modal-card" style="width: auto"> <div class="modal-card" style="width: auto">
<header class="modal-card-head"> <header class="modal-card-head">
<p class="modal-card-title">Create new token</p> <p class="modal-card-title">{{ trans('Create new token') }}</p>
</header> </header>
<section class="modal-card-body modal-newtoken"> <section class="modal-card-body modal-newtoken">
<div :class="Object.keys(newinterview.newtoken).length !== 0 ? 'token-img-newtokenInterview m-auto w-auto h-auto' : 'token-img-newtokenInterview m-auto'" > <div :class="Object.keys(newinterview.newtoken).length !== 0 ? 'token-img-newtokenInterview m-auto w-auto h-auto' : 'token-img-newtokenInterview m-auto'" >
...@@ -47,11 +47,11 @@ ...@@ -47,11 +47,11 @@
style="vertical-align: bottom; "> style="vertical-align: bottom; ">
</div> </div>
<div class="card-content"> <div class="card-content">
<label class="label">Token name</label> <label class="label">{{ trans('Token name') }}</label>
<input <input
class="input bg-gray-200 focus:bg-white border-transparent focus:border-blue-400" class="input bg-gray-200 focus:bg-white border-transparent focus:border-blue-400"
type="text" v-model="newinterview.newtoken.name"/> type="text" v-model="newinterview.newtoken.name"/>
<label class="label mt-5">Preset tokens</label> <label class="label mt-5">{{ trans('Preset tokens') }}</label>
<v-select class="":options="newinterview.imagepreset" label="basename" v-model="newinterview.newtoken.file" <v-select class="":options="newinterview.imagepreset" label="basename" v-model="newinterview.newtoken.file"
> >
<template slot="label" slot-scope="label"> <template slot="label" slot-scope="label">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<b-upload v-model="newinterview.newtoken.file" <b-upload v-model="newinterview.newtoken.file"
accept="image/*"> accept="image/*">
<a class="button is-danger"> <a class="button is-danger">
<div class="md:text-sm">Click to upload</div> <div class="md:text-sm">{{ trans('Click to upload') }}</div>
</a> </a>
<br> <br>
</b-upload> </b-upload>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<a :disabled="newinterview.newtoken.name == null || newinterview.newtoken.name == ''" <a :disabled="newinterview.newtoken.name == null || newinterview.newtoken.name == ''"
:class="newinterview.newtoken.name != null || newinterview.newtoken.name == ''? 'button is-primary text-2xl m-auto w-auto': 'button is-primary text-2xl opacity-50 cursor-not-allowed m-auto w-auto'" :class="newinterview.newtoken.name != null || newinterview.newtoken.name == ''? 'button is-primary text-2xl m-auto w-auto': 'button is-primary text-2xl opacity-50 cursor-not-allowed m-auto w-auto'"
@click.prevent="saveToken"> @click.prevent="saveToken">
Save {{ trans('Save') }}
</a> </a>
</div> </div>
</section> </section>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<section> <section>
<div :class="'sorting-container'+currentsorting" :id="'sortingc'+currentsorting" <div :class="'sorting-container'+currentsorting" :id="'sortingc'+currentsorting"
style="scroll-behavior: unset;"> style="scroll-behavior: unset;">
<h2 style="left:5%;position:absolute;top:15%;touch-action: none" class="remove-from-screenshot">Choose from prepared tokens.</h2> <h2 style="left:5%;position:absolute;top:15%;touch-action: none" class="remove-from-screenshot">{{ trans('Choose from prepared tokens.') }}</h2>
<div class="token-container has-to-move flex flex-row" id="token-container" style="top:20%;left:5%;height: 50%;width:25%;flex-wrap: wrap;"> <div class="token-container has-to-move flex flex-row" id="token-container" style="top:20%;left:5%;height: 50%;width:25%;flex-wrap: wrap;">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</new-token> </new-token>
<div class="token-container-created z-20 max-h-screen has-to-move" <div class="token-container-created z-20 max-h-screen has-to-move"
style="max-width: 20%;top:20%;"> style="max-width: 20%;top:20%;">
<h3 style="min-width:20%;" class="remove-from-screenshot relative">Your Created Tokens.</h3> <h3 style="min-width:20%;" class="remove-from-screenshot relative">{{ trans('Your Created Tokens.') }} </h3>
<div class="sortingstart inline-block createdtokens" :class="'token'+currentsorting" <div class="sortingstart inline-block createdtokens" :class="'token'+currentsorting"
v-for="(t,index) in tokens" v-for="(t,index) in tokens"
......
{ {
"E-Mail Address": "E-Mail Address", "E-Mail Address": "E-Mail Address",
"New Study": "New Study", "New Study": "New Studyyyy",
"Language": "Language", "Language": "Language",
"Create Study": "DaI!", "Create Study": "funzia?",
"To create a new study, you should provide some general information, choose a sorting scheme you wish to use and can add additional questions for your interviewees. To navigate between these options please use the three tabs provided below.": "To create a new study, you should provide some general information, choose a sorting scheme you wish to use and can add additional questions for your interviewees. To navigate between these options please use the three tabs provided below." "To create a new study, you should provide some general information, choose a sorting scheme you wish to use and can add additional questions for your interviewees. To navigate between these options please use the three tabs provided below.": "To create a new study, you should provide some general information, choose a sorting scheme you wish to use and can add additional questions for your interviewees. To navigate between these options please use the three tabs provided below.",
"Please give your study a name, assign one or more responsible researchers and add a short description. All information is mandatory to successful save the study.": "sì",
"Choose Sorting Scheme": "Choose sorting scheme",
"Create new study": "Crea uno studio nuovo."
} }
\ No newline at end of file
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
window.trans = []; window.trans = [];
window.trans = <?php window.trans = <?php
// copy all translations from /resources/lang/CURRENT_LOCALE/* to global JS variable // copy all translations from /resources/lang/CURRENT_LOCALE/* to global JS variable
/*
$lang_files = File::files(resource_path() . '/lang/' . App::getLocale()); $lang_files = File::files(resource_path() . '/lang/' . App::getLocale());
$trans = []; $trans = [];
foreach ($lang_files as $f) { foreach ($lang_files as $f) {
...@@ -35,8 +37,12 @@ ...@@ -35,8 +37,12 @@
$trans[$filename] = trans($filename); $trans[$filename] = trans($filename);
} }
*/
$json_file = File::get(resource_path()."/lang/". App::getLocale().'.json');
echo json_encode($trans,true); echo json_decode(json_encode($json_file, true));;
?>; ?>;
</script> </script>
@yield('pagespecificstyles') @yield('pagespecificstyles')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment