What if you could get static type checking, key documentation and code completion right in VS Code?
And what if the translations could be generated using an actual programming language, and even represent HTML markup and not just plain strings?
What if you could get static type checking, key documentation and code completion right in VS Code?
And what if the translations could be generated using an actual programming language, and even represent HTML markup and not just plain strings?
What would be useful is the ability to interactively see a systematic set of examples of what the templates one is editing evaluate to.
But since my translations are code, it basically means I would have to invoke a debugger on the full program, so that's a drawback.
On the other hand, since my translations are code I suppose I could just add something like a unit test or something.
That fails pretty badly in two cases:
1) If significant changes to the English (or whatever) version need to be made, keeping the original text may be more confusing than useful.
2) When the native-language version is ambiguous in a way that doesn't apply to other languages, e.g. when translating to languages with grammatical gender, or when a single English word can be used in multiple unrelated ways.
2. You usually (or it’s recommended to) translate entire phrases. Older systems like gettext use context and namespaces to differentiate source keys in a way that is helpful for various things. I believe this is (or should be) a non-problem for any modern system as well.
True, but reconciling translation files based on different keys can get messy. Using keys which aren't directly tied to the original language solves this.
> 2. You usually (or it’s recommended to) translate entire phrases
The kind of situation I'm thinking of is words that are used alone, but which are disambiguated by context -- for example, "clear" could be an action meaning "remove everything", or a synonym for "transparent", or an odd term for "approve".
Words used alone or need context should use the i18n libraries context abilities. Like p_(“clear”, “verb”) and p_(“clear”, “noun”). It’s also helpful to add comments and your translation system should be able to pick them up:
// translators: %d is an amount of money
If you are using a modern translation system that doesn’t support these features, perhaps “downgrading” to an older system is a good idea.