[tmp] vue i18n error
This commit is contained in:
parent
88996f81d8
commit
7b0bc22a71
|
@ -9,7 +9,7 @@
|
|||
<p
|
||||
v-if="state.org_name !== ''"
|
||||
class="mx-auto leading-relaxed text-base text-center"
|
||||
>Organization: {{ state.org_name }}</p>
|
||||
>{{ $t('organization') }}: {{ state.org_name }}</p>
|
||||
<p v-else class="mx-auto leading-relaxed text-base text-center">Bürgerlauf</p>
|
||||
<div class="mt-4">
|
||||
<label for="first_name" class="block font-medium">
|
||||
|
@ -247,6 +247,8 @@ import isEmail from 'validator/es/lib/isEmail';
|
|||
import isMobilePhone from 'validator/es/lib/isMobilePhone';
|
||||
import isPostalCode from 'validator/es/lib/isPostalCode';
|
||||
import { useToast } from "vue-toastification";
|
||||
import { router } from '../router';
|
||||
import { i18n } from '../language';
|
||||
|
||||
const props = defineProps({
|
||||
token: String
|
||||
|
@ -274,6 +276,9 @@ const state = reactive({
|
|||
&& userdetails.value.lastname && (provide_address.value === false || provide_address.value === true && (userdetails.value.address.street.trim() && userdetails.value.address.city.trim() && isPostalCode(userdetails.value.address.zipcode, "DE"))))
|
||||
})
|
||||
const toast = useToast();
|
||||
const $t = this.$t.bind(this)
|
||||
console.log($t);
|
||||
// console.log(i18n('you_have_been_registered'));
|
||||
function login() {
|
||||
userdetails = userdetails.value;
|
||||
if (userdetails.phone === "" || isMobilePhone(userdetails.phone)) {
|
||||
|
@ -305,9 +310,10 @@ function login() {
|
|||
axios.post(url, postdata)
|
||||
.then(({ data }) => {
|
||||
const token = btoa(data.token);
|
||||
location.replace("../profile/" + token)
|
||||
// location.replace("../profile/" + token)
|
||||
router.push("../profile/" + token);
|
||||
//
|
||||
toast.success("You have been registered!");
|
||||
toast.success($t('you_have_been_registered'));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import * as keys_en from './locales/en.json';
|
||||
import * as keys_de from './locales/de.json';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
|
||||
const messages = {
|
||||
en: keys_en,
|
||||
de: keys_de
|
||||
};
|
||||
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
|
||||
export const i18n = createI18n({
|
||||
locale: browserlocale,
|
||||
fallbackLocale: 'en',
|
||||
messages
|
||||
});
|
|
@ -1,41 +1,43 @@
|
|||
{
|
||||
"already_have_an_account": "Already have an account?",
|
||||
"apartment_suite_etc": "Apartment, suite, etc.",
|
||||
"configuration_error": "Configuration error",
|
||||
"confirm_personal_data": "I hereby confirm that the above information is complete and correct",
|
||||
"distance": "Distance",
|
||||
"download_certificate": "Download certificate",
|
||||
"e_mail_adress": "mail address",
|
||||
"go_to_login": "Go To Login",
|
||||
"i_accept": "I have read and accepted the ",
|
||||
"i_accept_end": "",
|
||||
"if_you_are_the_system_administrator_please_refer_to_the_official_product_documentation_readme_for_configuration_guidance": "If you are the system administrator, please refer to the official product documentation/ README for configuration guidance.",
|
||||
"imprint": "Imprint",
|
||||
"lap_time": "Lap time",
|
||||
"lap_times": "Lap times",
|
||||
"main_page_text": "Here you can register for the Lauf Für Kaya! or manage your runner profile.",
|
||||
"mittelname": "Middlename",
|
||||
"nachname": "Lastname",
|
||||
"no_laps_scans_were_recorded_yet": "No laps/ scans were recorded yet...",
|
||||
"ort": "City",
|
||||
"phone_number": "Phone Number",
|
||||
"please_provide_a_valid_zipcode": "Please provide a valid zipcode...",
|
||||
"please_provide_valid_mail": "Please provide a valid mail address.",
|
||||
"plz": "zipcode",
|
||||
"privacy_policy": "Privacy Policy",
|
||||
"profile": "Profile",
|
||||
"provide_address": "Provide a postal address?",
|
||||
"register": {
|
||||
"register_now": "Register now for Lauf für Kaya! 2021."
|
||||
},
|
||||
"register_now": "Register now!",
|
||||
"registrieren": "Register Now",
|
||||
"save_changes": "Save changes",
|
||||
"sponsoring": "Sponsoring",
|
||||
"strasse": "Street/ Block",
|
||||
"the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help": "The system is not properly configured. Please contact the system administrator for help.",
|
||||
"this_is_not_a_valid_international_phone_number": "This is not a valid international phone number",
|
||||
"tos": "Terms of Service",
|
||||
"view_my_data": "View my data",
|
||||
"vorname": "Firstname"
|
||||
}
|
||||
"already_have_an_account": "Already have an account?",
|
||||
"apartment_suite_etc": "Apartment, suite, etc.",
|
||||
"configuration_error": "Configuration error",
|
||||
"confirm_personal_data": "I hereby confirm that the above information is complete and correct",
|
||||
"distance": "Distance",
|
||||
"download_certificate": "Download certificate",
|
||||
"e_mail_adress": "mail address",
|
||||
"go_to_login": "Go To Login",
|
||||
"i_accept": "I have read and accepted the ",
|
||||
"i_accept_end": "",
|
||||
"if_you_are_the_system_administrator_please_refer_to_the_official_product_documentation_readme_for_configuration_guidance": "If you are the system administrator, please refer to the official product documentation/ README for configuration guidance.",
|
||||
"imprint": "Imprint",
|
||||
"lap_time": "Lap time",
|
||||
"lap_times": "Lap times",
|
||||
"main_page_text": "Here you can register for the Lauf Für Kaya! or manage your runner profile.",
|
||||
"mittelname": "Middlename",
|
||||
"nachname": "Lastname",
|
||||
"no_laps_scans_were_recorded_yet": "No laps/ scans were recorded yet...",
|
||||
"ort": "City",
|
||||
"phone_number": "Phone Number",
|
||||
"please_provide_a_valid_zipcode": "Please provide a valid zipcode...",
|
||||
"please_provide_valid_mail": "Please provide a valid mail address.",
|
||||
"plz": "zipcode",
|
||||
"privacy_policy": "Privacy Policy",
|
||||
"profile": "Profile",
|
||||
"provide_address": "Provide a postal address?",
|
||||
"register": {
|
||||
"register_now": "Register now for Lauf für Kaya! 2021."
|
||||
},
|
||||
"register_now": "Register now!",
|
||||
"registrieren": "Register Now",
|
||||
"save_changes": "Save changes",
|
||||
"sponsoring": "Sponsoring",
|
||||
"strasse": "Street/ Block",
|
||||
"the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help": "The system is not properly configured. Please contact the system administrator for help.",
|
||||
"this_is_not_a_valid_international_phone_number": "This is not a valid international phone number",
|
||||
"tos": "Terms of Service",
|
||||
"view_my_data": "View my data",
|
||||
"vorname": "Firstname",
|
||||
"organization": "Organization",
|
||||
"you_have_been_registered": "You have been registered!"
|
||||
}
|
||||
|
|
43
src/main.js
43
src/main.js
|
@ -1,49 +1,10 @@
|
|||
import { createApp } from 'vue';
|
||||
import { createWebHistory, createRouter } from 'vue-router';
|
||||
import App from './App.vue';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import Toast from 'vue-toastification';
|
||||
import 'windi.css';
|
||||
import 'toastify-js/src/toastify.css';
|
||||
import 'vue-toastification/dist/index.css';
|
||||
import * as keys_en from './locales/en.json';
|
||||
import * as keys_de from './locales/de.json';
|
||||
import { router } from './router';
|
||||
import { i18n } from './language';
|
||||
|
||||
const messages = {
|
||||
en: keys_en,
|
||||
de: keys_de
|
||||
};
|
||||
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
|
||||
const i18n = createI18n({
|
||||
locale: browserlocale,
|
||||
fallbackLocale: 'en',
|
||||
messages
|
||||
});
|
||||
|
||||
// ---------------
|
||||
const EnvError = import('./components/EnvError.vue');
|
||||
const Home = import('./components/Home.vue');
|
||||
const Imprint = import('./components/Imprint.vue');
|
||||
const Privacy = import('./components/Privacy.vue');
|
||||
const Register = () => import('./components/Register.vue');
|
||||
const Profile = () => import('./components/Profile.vue');
|
||||
//
|
||||
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];
|
||||
if (typeof config !== 'undefined') {
|
||||
if (config.baseurl && config.documentserver_key) {
|
||||
routes = [
|
||||
{ path: '/', component: Home },
|
||||
{ path: '/imprint', component: Imprint },
|
||||
{ path: '/privacy', component: Privacy },
|
||||
{ path: '/register', component: Register },
|
||||
{ path: '/register/:token', component: Register, props: true },
|
||||
{ path: '/profile/:token', component: Profile, props: true }
|
||||
];
|
||||
}
|
||||
}
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
});
|
||||
// ---------------
|
||||
createApp(App).use(Toast).use(i18n).use(router).mount('#app');
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import { createWebHistory, createRouter } from 'vue-router';
|
||||
// ------------
|
||||
const EnvError = import('./components/EnvError.vue');
|
||||
const Home = import('./components/Home.vue');
|
||||
const Imprint = import('./components/Imprint.vue');
|
||||
const Privacy = import('./components/Privacy.vue');
|
||||
const Register = () => import('./components/Register.vue');
|
||||
const Profile = () => import('./components/Profile.vue');
|
||||
//
|
||||
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];
|
||||
if (typeof config !== 'undefined') {
|
||||
if (config.baseurl && config.documentserver_key) {
|
||||
routes = [
|
||||
{ path: '/', component: Home },
|
||||
{ path: '/imprint', component: Imprint },
|
||||
{ path: '/privacy', component: Privacy },
|
||||
{ path: '/register', component: Register },
|
||||
{ path: '/register/:token', component: Register, props: true },
|
||||
{ path: '/profile/:token', component: Profile, props: true }
|
||||
];
|
||||
}
|
||||
}
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
});
|
Loading…
Reference in New Issue