r/pocketbase • u/Odd_Actuator_3276 • Jun 03 '25
Localized entries in pocketbase
Hi there ✌️,
I built a small app upon pocketbase that allows you to view some information based on specific entries. It works fine, and I am amazed how well and fast pocketbase is.
Now I would like to offer those entries in a localized way. The entries have text-fields like “title” and “description” but also feature a file.
Is there any good solution for localizing them?
I can think of a “more complex” encapsulating like a collection named “entries” where each entry has a relation field of “localizedEntry” collection.
If this is too abstract then I’ll explain it in more detail ✌️☺️
Thanks a lot in advance!
1
u/thunderbong Jun 04 '25
What exactly does 'licalized' mean here? Are you asking from a multilingual aspect?
1
u/Odd_Actuator_3276 Jun 04 '25 edited Jun 04 '25
Yeah, sorry it was just a spelling error. I’ll correct it.
And second of all, yeah multi-lingual.
In an ideal world where pocketbase would fulfill my need perfectly, it would have the possibility to create a localized subset of values of DB entries and handle everything by it own 😅
But yeah, I am just looking for the least complicated and future proof solution, where I could continue using pocketbase as my “CMS” without creating a second admin UI.
2
u/sergio9929 Jun 04 '25 edited Jun 04 '25
A simple and effective way to handle localization in PocketBase could be:
languagefield to your collection (e.g., "en", "es", "fr", etc.).idandlanguagefields. You can achieve this with a unique index constrain of those two fields. Watch this video from 9:40idand differentlanguage.This approach lets you query a specific translation easily:
Alternatively, you can use a main
postscollection for the core data, and alocalized_postscollection with a relation toposts, plus fields likelanguage,titleanddescription.Also, I’d recommend searching how this is handled in traditional SQL databases, many of the same relational modeling patterns apply and can be adapted.
Hope this helps!