Hi AppWrite Community,
I'm working on a project that requires supporting multiple languages for a variety of content stored in the AppWrite database. Specifically, I need to localize several fields such as names, descriptions, and user-generated content across different collections.
I've considered using nested fields for each language, like this:
{
"$id": "example_document",
"name": {
"en": "Example Name",
"it": "Nome Esempio",
"es": "Nombre Ejemplo"
},
"description": {
"en": "Example description in English.",
"it": "Descrizione di esempio in italiano.",
"es": "Descripción de ejemplo en español."
}
}
However, this approach seems to require creating new collections or nested fields for every field that needs localization, which can become complex and hard to manage as the number of supported languages and the volume of content grow.
Questions:
- What are the best practices for efficiently storing and querying localized content in AppWrite without creating new collections for every localized field?
- Are there any built-in features that facilitate content localization in AppWrite?
- How do you handle indexing and querying performance when dealing with multiple languages in a single collection?
- Are there any common pitfalls or challenges to be aware of when implementing localization in AppWrite, and how can they be mitigated?
Any insights, examples, or experiences you can share would be greatly appreciated!
Thanks in advance for your help!
No one? 😦
- I’m not sure why you’d be creating new Collections for each field here? It looks like you’d just want to create a new Document for each field.
I would probably have a new Document for every language of every field. So each document would hold a field ID, the language code and the string.
- Not as far as I’m aware.
- You can create Indexes in Appwrite, which behind the scenes are just MariaDB indexes.
- I’m not aware of anyone who’s actually done this with Appwrite, but practically, there shouldn’t be any Appwrite specific challenges here
Thanks for the explanation. I think your proposal makes a lot of sense, so I will probably add a new custom field to identify the language of every document. This means having multiple documents for every language, but it will optimize how they are managed.
Np. If your issue has been solved, you can mark this post as closed by adding "[SOLVED]" to the beginning of the title
[Solved] Best Practices for Localizing Content in AppWrite Database
Hi there, I'd like to validate I understand your solution. So, in your case, you will have 3 documents? 1. "example_document_en", 2. "example_document_it", 3. "example_document_es"? And within each document a new field inside identifying the language, like "lang" = 'es' for the first document, and 'it' for the second, and 'es' for the last? This is the solution I'm actually considering for my project, that's why I'd like to validate with your idea and experience, if possible! Thanks a lot.
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Edit ID of an existing collection
Hi there. Is it possible to edit an ID of an existing collection? Right now it looks impossible from AppWrite cloud at least.
- Seed db
hello there... is this correct way to seed appwrite