i18n compatible datatable
This commit is contained in:
parent
016f08b07c
commit
3c36bea07c
@ -1,11 +1,13 @@
|
||||
<script>
|
||||
import { _, t } from "svelte-i18n";
|
||||
import { getlang } from "./datatable_i18n";
|
||||
import { Grid } from "gridjs";
|
||||
import "gridjs/dist/theme/mermaid.css";
|
||||
import { nanoid } from "nanoid";
|
||||
//
|
||||
const uniq = nanoid();
|
||||
let table;
|
||||
const datatable = new Grid({
|
||||
columns: ["Name", "Email", "Phone Number"],
|
||||
language: getlang($_("datatable")),
|
||||
sort: true,
|
||||
search: { enabled: true },
|
||||
data: [
|
||||
@ -22,8 +24,8 @@
|
||||
},
|
||||
});
|
||||
setTimeout(() => {
|
||||
datatable.render(document.getElementById("wrapper" + uniq));
|
||||
datatable.render(table);
|
||||
}, 0);
|
||||
</script>
|
||||
|
||||
<div id="wrapper{uniq}" />
|
||||
<div bind:this={table} />
|
||||
|
24
src/components/datatable_i18n.js
Normal file
24
src/components/datatable_i18n.js
Normal file
@ -0,0 +1,24 @@
|
||||
export function getlang(langkeys) {
|
||||
return {
|
||||
search: {
|
||||
placeholder: langkeys.search
|
||||
},
|
||||
sort: {
|
||||
sortAsc: langkeys.sort_column_ascending,
|
||||
sortDesc: langkeys.sort_column_descending
|
||||
},
|
||||
pagination: {
|
||||
previous: langkeys.previous,
|
||||
next: langkeys.next,
|
||||
navigate: (page, pages) => `${langkeys.page} ${page} ${langkeys.of} ${pages}`,
|
||||
page: (page) => `${langkeys.page} ${page}`,
|
||||
showing: langkeys.showing,
|
||||
of: langkeys.of,
|
||||
to: langkeys.to,
|
||||
results: langkeys.records
|
||||
},
|
||||
loading: langkeys.loading,
|
||||
noRecordsFound: langkeys.no_matching_records_found,
|
||||
error: langkeys.an_error_happened_while_fetching_the_data
|
||||
};
|
||||
}
|
@ -21,5 +21,8 @@
|
||||
"dont-have-your-email-connected": "Deine E-Mail ist nicht verknüpft?",
|
||||
"reset-my-password": "Passwort zurücksetzen",
|
||||
"e-mail-adress": "E-Mail-Adresse",
|
||||
"invalid-mail-reset": "Das ist keine gültige E-Mail"
|
||||
"invalid-mail-reset": "Das ist keine gültige E-Mail",
|
||||
"datatable": {
|
||||
"search": "🔍 Suche ..."
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,47 @@
|
||||
{
|
||||
"forgot_password?": "Forgot your password?",
|
||||
"register": "Register",
|
||||
"log_in": "Log in",
|
||||
"password": "Password",
|
||||
"log_in_to_your_account": "Log in to your account",
|
||||
"welcome_wavinghand": "Welcome 👋",
|
||||
"login_is_checked": "Login is being checked...",
|
||||
"error_on_login": "Error on login",
|
||||
"settings": "Settings",
|
||||
"your_profile": "Your Profile",
|
||||
"email_address_or_username": "Email / username",
|
||||
"tracks": "Tracks",
|
||||
"signout": "Sign out",
|
||||
"hallo": "hallo",
|
||||
"404message": "Sorry, the page you are looking for could not be found.",
|
||||
"404title": "Error 404",
|
||||
"goback": "Go Home",
|
||||
"application_name": "Lauf für Kaya! - Admin",
|
||||
"reset-my-password": "Reset my password",
|
||||
"cannot-reset-your-password-directly": "Bummer. We unfortunately cannot reset your password directly. Please send us a mail and confirm your identity",
|
||||
"send-a-mail-to-lfk-odit-services": "send a mail to lfk@odit.services",
|
||||
"dont-have-your-email-connected": "Don't have your email connected?",
|
||||
"dont-panic-were-resetting-it": "Don't panic, we're resetting it ✌",
|
||||
"e-mail-adress": "E-Mail Adress",
|
||||
"mail-validation-in-progress": "mail validation in progress...",
|
||||
"invalid-mail-reset": "the provided email is invalid",
|
||||
"runners": "runners",
|
||||
"total-scans": "total scans",
|
||||
"total-donations": "total donations",
|
||||
"total-distance": "total distance"
|
||||
"forgot_password?": "Forgot your password?",
|
||||
"register": "Register",
|
||||
"log_in": "Log in",
|
||||
"password": "Password",
|
||||
"log_in_to_your_account": "Log in to your account",
|
||||
"welcome_wavinghand": "Welcome 👋",
|
||||
"login_is_checked": "Login is being checked...",
|
||||
"error_on_login": "Error on login",
|
||||
"settings": "Settings",
|
||||
"your_profile": "Your Profile",
|
||||
"email_address_or_username": "Email / username",
|
||||
"tracks": "Tracks",
|
||||
"signout": "Sign out",
|
||||
"hallo": "hallo",
|
||||
"404message": "Sorry, the page you are looking for could not be found.",
|
||||
"404title": "Error 404",
|
||||
"goback": "Go Home",
|
||||
"application_name": "Lauf für Kaya! - Admin",
|
||||
"reset-my-password": "Reset my password",
|
||||
"cannot-reset-your-password-directly": "Bummer. We unfortunately cannot reset your password directly. Please send us a mail and confirm your identity",
|
||||
"send-a-mail-to-lfk-odit-services": "send a mail to lfk@odit.services",
|
||||
"dont-have-your-email-connected": "Don't have your email connected?",
|
||||
"dont-panic-were-resetting-it": "Don't panic, we're resetting it ✌",
|
||||
"e-mail-adress": "E-Mail Adress",
|
||||
"mail-validation-in-progress": "mail validation in progress...",
|
||||
"invalid-mail-reset": "the provided email is invalid",
|
||||
"runners": "runners",
|
||||
"total-scans": "total scans",
|
||||
"total-donations": "total donations",
|
||||
"total-distance": "total distance",
|
||||
"datatable": {
|
||||
"search": "🔍 Search...",
|
||||
"sort_column_ascending": "Sort column ascending",
|
||||
"sort_column_descending": "Sort column descending",
|
||||
"previous": "Previous",
|
||||
"next": "Next",
|
||||
"page": "Page",
|
||||
"showing": "Showing",
|
||||
"records": "Records",
|
||||
"of": "of",
|
||||
"to": "to",
|
||||
"loading": "Loading...",
|
||||
"no_matching_records_found": "No matching records found",
|
||||
"an_error_happened_while_fetching_the_data": "An error happened while fetching the data"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user