A
A
Artem00712017-11-16 13:11:44
MySQL
Artem0071, 2017-11-16 13:11:44

How to make multilingual notifications?

Made one site
He is on vuejs, and made it into several languages ​​(ru/en). Now there are just 2 files ru.js and en.js. All system texts that are on the site are built into them and, depending on the selected language, one of the files is connected.
I want to fasten notifications.
1) How to actually make them and take into account viewing? (in terms of the database structure)
there are users USERS(user_id) and notifications NOTIFICATIONS(not_id)
If I don't know how much notification will be in the future (many/few) how to store everything in these cases?
- create a separate user_notif(user_id, notif_id) and, when a new notification is issued, add a notification to this table for each user, and delete it after reading
- on the contrary, only after reading, write to this table and then do some kind of NOT IN
Which of these will be more correct and more optimized?
2) How to make them multilingual? Just add several columns for languages ​​(when replenishing languages, immediately add columns)? Or is it better to add new files to the site itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cicatrix, 2017-11-16
@Artem0071

Store only the message ID with the user.
In the message table, store variable parameters and a flag (1 - new, 0 - viewed)
The constant text part - in a separate table with the language identifier.
...
something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question