fonction traduction
This commit is contained in:
14
src/assets/traduction.json
Normal file
14
src/assets/traduction.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"en": {
|
||||
"translation": {
|
||||
"welcome": "Welcome to the app!",
|
||||
"hello": "Hello, {{name}}!"
|
||||
}
|
||||
},
|
||||
"fr": {
|
||||
"translation": {
|
||||
"welcome": "Bienvenue dans l'application !",
|
||||
"hello": "Bonjour, {{name}} !"
|
||||
}
|
||||
}
|
||||
}
|
@ -152,8 +152,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
// NextCloud Components
|
||||
import { getClient, getRootPath, getFavoriteNodes } from '@nextcloud/files/dav';
|
||||
@ -172,6 +170,10 @@ import Plus from 'vue-material-design-icons/Plus.vue'
|
||||
import Delete from 'vue-material-design-icons/Delete.vue';
|
||||
import Pencil from 'vue-material-design-icons/Pencil.vue'
|
||||
|
||||
// Traduction
|
||||
import i18next from "i18next";
|
||||
import file from "../assets/traduction.json";
|
||||
|
||||
export default {
|
||||
name: 'FileTable',
|
||||
components: {
|
||||
@ -211,6 +213,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
trad: null,
|
||||
files: [], // Liste des fichiers et dossiers récupérés
|
||||
root_path: getRootPath(),
|
||||
current_dir: '/',
|
||||
@ -237,6 +240,14 @@ export default {
|
||||
async mounted() {
|
||||
await this.fetchFiles();
|
||||
this.breadcrumbParts = this.getBreadcrumbParts();
|
||||
|
||||
await i18next.init({
|
||||
lng: navigator.language.split('-')[0],
|
||||
fallbackLng: "en",
|
||||
resources: file,
|
||||
});
|
||||
|
||||
console.log(i18next.t('welcome'))
|
||||
},
|
||||
methods: {
|
||||
async changeTab(name) {
|
||||
@ -657,6 +668,9 @@ export default {
|
||||
|
||||
return cssStyle;
|
||||
},
|
||||
translate(id) {
|
||||
return i18next.t(id)
|
||||
},
|
||||
async sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
Reference in New Issue
Block a user