this post was submitted on 11 Aug 2024
210 points (97.7% liked)
Lemmy Apps
5457 readers
26 users here now
A home for discussion of Lemmy apps and tools for all platforms.
RULES:
- No spamming
- Be nice and have fun
- Follow the general lemmy.world rules
An extensive list of Lemmy apps is available here:
Visit our partner Communities!
Lemmy Plugins and Userscripts is a great place to enhance the Lemmy browsing experience. !plugins@sh.itjust.works
Lemmy Integrations is a community about all integrations with the lemmy API. Bots, Scripts, New Apps, etc. !lemmy_integrations@lemmy.dbzer0.com
Lemmy Bots and Tools is a place to discuss and show off bots, tools, front ends, etc. you’re making that relate to lemmy. !lemmy_dev@programming.dev
Lemmy App Development is a place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform. !lemmydev@lemm.ee
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
There's two approaches you can use here.
You can use a list of strings used in the app and have each string only occur once. Then using translation files you can translate each of those strings into another language.
This usually works fine, but has the downside of losing the context of a string. Context can matter a lot when translating, you often see this when the wrong translation is used, which is a correct translation but not for the context it's in. It can also be tricky when two strings are the same not by definition, but by chance. When in another language those strings should not be the same, this can't be resolved easily.
So for situations where a better translation is required another approach is used. Instead of strings directly, placeholders are used. These placeholders should be structured in such a way, the context is obvious and people could find where it's used easily. These placeholders are also unique, where two strings that are the same by chance don't use the same placeholder. Then for each language, including the "primary" language, a translation file is used. That translation file translates the placeholders into the correct string. For translating the translator uses the placeholders and the primary language file to translate the strings. Good tools for this exist that allow the same strings to be translated once, but show the context so the translator can decide to use different translations for the same string in a different context.
Using the placeholder approach is a bit more work and adds some overhead, but I've seen it used to produce awesome results. It prevents the pitfalls of the simpler approach.