New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement translation support #533
Conversation
@AJenbo There is a danger with that approach when mixing For UI components, perhaps we could mark it explicitly with a wrapper type: struct UiStringView {
constexpr UiStringView(const char *text, bool localize = false)
: localize_(localize), text_(text) {
}
const char *localized() const {
if (localize_) return gettext(text_);
return text_;
}
// (or make the fields public and move the logic to render/display code)
private:
bool localize_;
const char *text_;
}; The macro would return this type and the static arrays would change from: -const char *const CREDITS_LINES[] = {
+const UiStringView CREDITS_LINES[] = { The type above is implicitly constructible from a C-string literal. |
E.g. like this: https://godbolt.org/z/4fnjQy |
If any one can getting this building on Windows, Mac and Swtich I would appreciate the help. |
DeepCode's analysis on #2a5691 found:👉 View analysis in DeepCode’s Dashboard |
Looks like https://github.com/SuperTux/supertux is a good example of how to get this implemented for Windows and Mac |
|
||
#: SourceX/DiabloUI/selconn.cpp:41 | ||
msgid "no gateway needed" | ||
msgstr "ingen gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msgstr "ingen gateway" | |
msgstr "gateway behøves ikke" |
(check if this fits first)
This brings translation support to the game, it will probably need a bit of adjustment on different platforms and for the handling of static texts. Currently, also only the strings from DiabloUI and appfat.cpp are marked as translatable.
Fixes #66