Recently, I was working on a Vue-based application where I decided to explore a bit how I could adapt the frontend architecture (or more specifically - the folder structure and the config, in this case) to work with multiple locale/translation files, including nested in other directories.

Getting a single locale JSON file for each language is easy, especially if you work with Vite in your project, but what about multiple files for the same locale/language? Well, it is not that much of a big deal. I played around a bit with different solutions and our beloved ChatGPT has suggested the following approach.

The code

First step is to assign the translation files to a messages variable, and the catch here is, that if you want to assign a name to a specific set of translations (l…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help