mirror of
https://github.com/getbible/app.git
synced 2024-12-22 15:58:55 +00:00
added translation from store
This commit is contained in:
parent
e59f24b414
commit
897d99dc35
@ -8,10 +8,10 @@
|
|||||||
<select @change="update_bk()" v-model="translation" class="uk-select" id="inputGroupSelect01">
|
<select @change="update_bk()" v-model="translation" class="uk-select" id="inputGroupSelect01">
|
||||||
<!-- <option selected value="1">Choose...</option> -->
|
<!-- <option selected value="1">Choose...</option> -->
|
||||||
<option
|
<option
|
||||||
class="uk-animation-slide-bottom uk-animation-15" v-for="(tr,i) in Object.keys(translations)"
|
class="uk-animation-slide-bottom uk-animation-15" v-for="(tr,i) in translations"
|
||||||
:key="i"
|
:key="i"
|
||||||
:value="tr"
|
:value="tr.abbreviation"
|
||||||
>{{translations[tr]["language"]?`(${translations[tr]["language"]})`:null}} {{translations[tr]['translation']}}
|
>{{tr["language"]?`(${tr["language"]})`:null}} {{tr['translation']}}
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@ -47,8 +47,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<verses
|
<verses
|
||||||
v-if="books[book] "
|
v-if="translations.length && books[book]"
|
||||||
:dir="translations[translation].direction.toLowerCase()"
|
:dir="t(translation).direction.toLowerCase()"
|
||||||
:book_name="books[book].name"
|
:book_name="books[book].name"
|
||||||
:chapter="fchapters"
|
:chapter="fchapters"
|
||||||
/>
|
/>
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
data: function(){
|
data: function(){
|
||||||
return {
|
return {
|
||||||
translation: 'akjv',
|
translation: 'akjv',
|
||||||
translations: {},
|
// translations: {},
|
||||||
chapter: 1,
|
chapter: 1,
|
||||||
chapter_num: 1,
|
chapter_num: 1,
|
||||||
chapters:{},
|
chapters:{},
|
||||||
@ -78,6 +78,10 @@ export default {
|
|||||||
message: 'Loading...'
|
message: 'Loading...'
|
||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
|
translations(){
|
||||||
|
return this.$store.state.settings.savedTr;
|
||||||
|
},
|
||||||
|
|
||||||
fchapters: function (){
|
fchapters: function (){
|
||||||
if(!this.search)
|
if(!this.search)
|
||||||
return this.chapter.verses
|
return this.chapter.verses
|
||||||
@ -92,7 +96,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
update_chapter() {
|
t(i){
|
||||||
|
return this.translations.find(t => t.abbreviation === i)
|
||||||
|
},
|
||||||
|
async update_chapter() {
|
||||||
// this.loading = true
|
// this.loading = true
|
||||||
this.progress = 95
|
this.progress = 95
|
||||||
let config = {
|
let config = {
|
||||||
@ -101,7 +108,7 @@ export default {
|
|||||||
|
|
||||||
let url = `https://getbible.net/v2/${this.translation}/${this.book}/${this.chapter_num}.json`
|
let url = `https://getbible.net/v2/${this.translation}/${this.book}/${this.chapter_num}.json`
|
||||||
|
|
||||||
let response = fetch(url, config).catch(function(err) {
|
let response = await fetch(url, config).catch(function(err) {
|
||||||
this.chapter = err
|
this.chapter = err
|
||||||
this.loading =false
|
this.loading =false
|
||||||
this.message = 'Error'
|
this.message = 'Error'
|
||||||
@ -111,7 +118,7 @@ export default {
|
|||||||
if (!response) return;
|
if (!response) return;
|
||||||
|
|
||||||
this.progress = 99
|
this.progress = 99
|
||||||
let data = response.json().catch(err => {
|
let data = await response.json().catch(err => {
|
||||||
this.chapter = err
|
this.chapter = err
|
||||||
this.loading =false
|
this.loading =false
|
||||||
this.message = 'Error'
|
this.message = 'Error'
|
||||||
@ -171,11 +178,11 @@ export default {
|
|||||||
let config = {
|
let config = {
|
||||||
headers: {'Access-Control-Allow-Origin': '*'}
|
headers: {'Access-Control-Allow-Origin': '*'}
|
||||||
};
|
};
|
||||||
fetch(`https://getbible.net/v2/translations.json`,config)
|
// fetch(`https://getbible.net/v2/translations.json`,config)
|
||||||
.then(response => response.json())
|
// .then(response => response.json())
|
||||||
.then(data => {
|
// .then(data => {
|
||||||
// console.log(data)
|
// // console.log(data)
|
||||||
this.translations = data
|
// this.translations = data
|
||||||
|
|
||||||
fetch(`https://getbible.net/v2/${this.translation}/books.json`, config)
|
fetch(`https://getbible.net/v2/${this.translation}/books.json`, config)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@ -187,18 +194,18 @@ export default {
|
|||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
this.chapter = err
|
this.chapter = err
|
||||||
});
|
});
|
||||||
}).catch(function(err) {
|
// }).catch(function(err) {
|
||||||
this.chapter = err
|
// this.chapter = err
|
||||||
});
|
// });
|
||||||
|
|
||||||
fetch(`https://getbible.net/v2/kjv/${this.book}/${this.chapter_num}.json`,config)
|
// fetch(`https://getbible.net/v2/kjv/${this.book}/${this.chapter_num}.json`,config)
|
||||||
.then(response => response.json())
|
// .then(response => response.json())
|
||||||
.then(data => {
|
// .then(data => {
|
||||||
console.log(data)
|
// console.log(data)
|
||||||
this.chapter = data
|
// this.chapter = data
|
||||||
}).catch(function(err) {
|
// }).catch(function(err) {
|
||||||
this.chapter = err
|
// this.chapter = err
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user