7 ms·
Fluent – A localization system for natural-sounding translations
- rhyme-boss 3y agoI kind of despise the pattern where in order to support translations you have to turn every string in your program into an abomination of bespoke markup, storing strings in variables, etc..
- winternewt 3y agoDo you have any alternative in mind? Assuming we want the user interface to have grammatically correct language.
- rhyme-boss 3y agouse a delimiter that's already in your markup to identify strings, and then translate those. Like look at `<p>` boundaries and other tags that wrap plain text, and attach an attribute like data-translation-id.
- tmpfs 3y agoI have used this and it is a welcome advance on the older techniques such as gettext. Just be aware that not all the implementations have all the functionality, for example, i learnt the rust implementation does not yet support the date/time formatting. I recommend taking it for a spin.
- Ygg2 3y agoIt's going to be hard to have a date/time format when no standardized date/time lib.
- ogoffart 3y ago> welcome advance on the older techniques such as gettext. I disagree. I think it depends on the use-cases. I blogged about that recently: https://slint-ui.com/blog/translation-infrastructure https://slint-ui.com/blog/translation-infrastructure In short, I much prefer having the original (English) in the source code as it makes it easier to maintain and removes level of indirection. Using message identifiers adds boilerplate.
- iudqnolq 3y agoI've never worked on a localized project but Fluent's explanation for why they use identifiers makes a lot of sense to me. I didnt see anything in your blog post addressing their issues with English source identifiers. https://github.com/projectfluent/fluent/wiki/Fluent-vs-gettext#social-contract https://github.com/projectfluent/fluent/wiki/Fluent-vs-gette... > The most important difference between gettext and Fluent is the choice of a message identifier. Gettext approaches the problem by taking the source string (often English). While the choice seem simple, it has long standing consequences in form of two limitations that this choice imposes. First of all, it means that any change to the source string invalidate all translations of the string. This severely increases the burden on the developers to never alter messages in the source language as it results in all translations having to be updated. > Secondly, it makes it harder to introduce multiple messages with the same source string which should be translated differently ... > Fluent establishes a social contract between the developer and localizers. The developer introduces a unique identifier and provides a set of variables such as number of unread emails or the name of the user, and localizers are using Fluent syntax features to construct the best possible translation for that identifier.
- tmpfs 3y agoExactly, thanks for highlighting this, it always really irked me about the gettext design that they were tightly coupled to the source translations.
- comex 3y agoI’ve never worked on localization either, but I do spend a lot of time reading other people’s source code, and I always find it mildly annoying when a project uses identifiers because it means I have to grep twice: once for the message (to find the identifier) and once for the identifier (to find the code that uses it). In projects that embed messages directly, I only have to grep once. I’ve wondered about the possibility of having the best of both worlds: have the source code contain the full English message (and no other identifier), but use a tool that automatically assigns identifiers to source code locations that contain messages. Different locations would get different identifiers even if they use the same string. The tool would have to be history-aware, in order to keep the identifier the same if the code is moved or if the message is edited. It would have to use heuristics to differentiate between “message was edited” and “message was deleted, and an unrelated message was added in roughly the same place”. But in practice this would usually be easy to do. …Or you could simplify things drastically by having the source code contain both the English message and a unique identifier (perhaps just a number rather than anything descriptive). That’s less fun though.
- jillesvangurp 3y agoIt has its rough edges but overall it's pretty nice indeed. Nicer than using dumb property files in any case. The only rough edges are with the more advanced things you'd in any case not have access to otherwise. We actually built a multi platform kotlin library that adapts the jvm implementation and the js implementation for project fluent. The java library we use is indeed a bit limited for some things. We've been working around some of those issues by doing our own variable processing. Overall, it's been useful for us and we're using the same localization strings in our spring server and kotlin-js web ui. https://github.com/formation-res/fluent-kotlin https://github.com/formation-res/fluent-kotlin It's not very widely used and has a few rough edges. But it works for us and it should be fairly straightforward to adapt it for e.g. Android and IOS if you need that. A neat trick these days is to translate fluent localization files with chat gpt and asking it to preserve the structure and identifiers. Actually works. We got it to translate hundreds of strings in a few languages. The translations were good quality and we found very few issues with this. Only took a few minutes. GPT 4 understands most major and minor languages in this world.
- Ygg2 3y agoIt's one of Mozilla projects. I ported fluent.rs to C# after current FluentDotNet Ftl implementation was abandoned. Interesting format, very simple compared to MessageFormat2. A bit too simple. To be honest.
- jfk13 3y ago> A bit too simple Why do you say that -- are there particular capabilities it is lacking?
- Ygg2 3y agoDynamic message references. Like say you want to make message like X skeleton(s) attacked Y dragon(s) generic over type of attacker/defender. Currently only option is to duplicate it or deal with it in program.
- ReleaseCandidat 3y agoThat doesn't work. You need to know the gender and actual number `X` of `X skeletons` to be able to (correctly ;) translate `attacked` in many languages. To correctly translate `X skeletons`, you need to know `X` and whether they are the attacker or being attacked. Same for `Y dragons`. In the end, you do not gain much but have a _really_ complex template (for such a simple phrase).
- Ygg2 3y agoSure it does, you need a way to pass arguments for case/gender etc. It's not impossible to make it work, I already implemented a prototype for it, but it requires changes to how it handles references. See https://github.com/projectfluent/fluent/issues/80 https://github.com/projectfluent/fluent/issues/80 for more details.
- jfk13 3y agoSee also https://news.ycombinator.com/item?id=16763092 https://news.ycombinator.com/item?id=16763092 (5 years ago, 10 comments)
- avgcorrection 3y agotl;dr of that thread: > I don’t get it. Where’s the localizations [read: non-English]? > One of the authors: haha, there’s only English so far because it’s not localized yet :)
- progx 3y agoThe idea is nice, but i can't remember that i need such complex translation in any app. The few cases could add with a simple if-else-switch.
- kristiandupont 3y agoAre you speaking on behalf of the user or the developer here? And, as a native English speaker or not? I have definitely seen my fair share of quirky texts in Danish UI's. It's not the end of the world but something that can clearly be improved.
- winternewt 3y agoEven in Microsoft products, the Swedish translation is sometimes so bad that I can't understand what they are saying. The trend is that translation quality is declining. Fluent seems like a great step forward but the bigger issue is corporations are not ready to put in the work needed.
- deleted 3y ago[deleted]
- fit2rule 3y ago[dead]
- Gare 3y agoI'm a Croatian developer that develops apps with multilingual interfaces. Fluent has been great for me.
- sergioisidoro 3y agoI'm going to assume you are building mostly in English, or in languages that maps simply to English (eg. With the same number of plurals). If you have 3 or more plural cases, plus gender (including neutral) you already have a multitude of cases in an if/else.
- mirekrusin 3y agoThis one from landing page is not correct: tabs-close-warning: Zostanie zamkniętych 1 kart. Czy chcesz kontynuować? should be: tabs-close-warning Karta zostanie zamknięta. Czy chcesz kontynuować?
- jwilk 3y agoIn the real code, this message is only shown when closing more than one tab.
- avgcorrection 3y agoSeems that this is implemented [1] in: - JavaScript - Rust - Python [1] https://github.com/projectfluent/fluent/wiki https://github.com/projectfluent/fluent/wiki
- Ygg2 3y agoThere are unofficial implementations - C# https://github.com/Ygg01/Linguini https://github.com/Ygg01/Linguini