-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
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
Multi-language support #15453
Multi-language support #15453
Conversation
d019f78
to
aaa5eef
Compare
This could be useful if many strings work this way. #define SRAM_STRING(VAR,SNAME) \
PGM_P __PSTR##VAR = GET_TEXT(SNAME); \
char VAR[strlen_P(__PSTR##VAR) + 1]; \
strcpy_P(VAR, __PSTR##VAR)
SRAM_STRING(tmp, MSG_INFO_PSU); It must certainly waste a lot of space to have a whole different string for each extruder, and I am currently working on an improvement to allow for any number of extruders without needing to add a new E entry for everything that deals with multiple tools. Going forward, let us find a way to get "E0, E1, E2..." strings without having to make several copies of strings with only one character differing. I suggest that we include |
57a70ce
to
3de7b21
Compare
Ok, all of Saturday was spent sharing the tedium and getting this patched up. It has some implications for my upcoming PR #15452 so it was good to get familiar with all the changes. This might still not be passing all the tests, but it is a lot closer! |
577ec64
to
5d49f9c
Compare
Rebased……
|
@thinkyhead: Just as an FYI, in my first attempt at doing this PR I made a new type called |
It may be possible to apply static strings only when it is cheaper to do so. For example, if we find that it's cheaper to use static strings over a |
ff8cb6c
to
8958d1a
Compare
Ok, patched up the last (?) few typos. If all is well, this will be merged pretty soon… Then I get to have fun resolving 100 conflicts in 15452! |
323c2be
to
2c5c149
Compare
c35d436
to
f429a48
Compare
I had to make a change to the language codes because |
f0c267a
to
52663fe
Compare
9f4b07f
to
af80653
Compare
c96be8f
to
2798f7e
Compare
- Language strings are now in their own namespaces. - Added a GET_TEXT() macro for retrieving strings in the current language. - It is now possible to have multiple languages compiled into the firmware.
2798f7e
to
82788a3
Compare
Ok, I put in another 10 hours on this today, for a total of about 50 hours just on this PR this week! When you said it was a tedious task, you weren't kidding. I have been running tests and patching for the last few hours and it is looking pretty close at this point. The language strings themselves are the trickiest part. I expect to set up an online database at some point so that we can manage our translations with a proper web interface. It could just be done as a Google spreadsheet, but I think that would be limiting. @shitcreek and I both have had illustrious web careers, so we'll have to flip a coin to see who gets the honor… |
Yeah, sounds about right, I've been struggling with this one for a few weeks. I appreciate you helping. When it's all done, I think it will be worthwhile.
Yay!
Yes, there are many of them, which makes changes hard. I did the bulk of the work with a Python script, but it took me most of a week to write that script, so it's hard to know whether I saved any time! Anyhow, at least I think it would be easy to convert that script into a "lint" program for the language files, something that will identify missing or unused strings, that might make the job easier going forwards. |
I have never used lint, but it sounds like the right tool for the job. |
Since Marlin wants to send static strings to |
bf2ef7f
to
3f2ad53
Compare
3f2ad53
to
835a512
Compare
@@ -293,7 +293,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { | |||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue")); | |||
#endif | |||
#if ENABLED(EXTENSIBLE_UI) | |||
ExtUI::onUserConfirmRequired(PSTR("Stow Probe")); | |||
ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe")); |
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.
@InsanityAutomation — @marcio-ao — It sounds like you should confer on whether this is the proper use case for onUserConfirmRequired
.
GET_TEXT()
macro for retrieving strings in the current language.This was an extremely tedious PR to make and I probably made some mistakes along the way, but I wanted to get this pushed as a PR so get some help finalizing and testing it.