


























I've begun my next Great Work for [jnet](https://jinteki.net]: support full translations for the game log (including all card ability).
We currently do string manipulation and concatenation, with no built in templates, so handle all messages shown to players. This has worked pretty well but leads to a lot of inconsistency and some obnoxious code paths to correctly bundle everything together. Folks have asked for translations for years, and we have fairly robust support in the UI, but the game engine has remained elusive.
I decided to try my hand at this in part because I'm stubborn and like a challenge and in part because I have spent the last year refining our Project Fluent set up, which has made translating the UI a breeze.
The big problem is that I am really tied to our current way of displaying and writing messages, so I don't want to drastically degrade the quality of those messages in a Fluent-based architecture. However, this means the task of transforming the data to Fluent Messages is a lot more complex. Our messages can contain 3-5 different variable portions ("$player pays $payment to use $card to do $ability" where ability can be arbitrarily complex), so figuring out how to create "templates" is interesting and challenging.
My next big challenge is creating Fluent Functions to handle certain constructs, which should reduce some of our boilerplate. Sadly, they made the smart decision to not allow arbitrary nested references and passing variables between messages, so some things have to be awkward and long winded.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。