-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Translate strings for connection/disconnection #2094
Conversation
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.
Thanks a ton!
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.
Thanks a ton!
Looks like you're missing some semicolons: https://travis-ci.org/Mudlet/Mudlet/jobs/447586154#L4494 |
Fixed. Thanks for the feedback! |
Some more - there is no tr() in main.cpp: https://travis-ci.org/Mudlet/Mudlet/jobs/447649485#L1825 |
Getting close - missing some closing brackets and something to concatenate the build number together? https://travis-ci.org/Mudlet/Mudlet/jobs/447660104#L2784 |
Another one, need a bracket on "ne"): |
Getting there - I think |
Missing a closing semicolon: https://travis-ci.org/Mudlet/Mudlet/jobs/447726380#L5487 Getting there! |
🎉 nice work |
@Kebap feel free to merge this in, by the way |
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.
QString::toLatin1()
)...
if (lua_isstring(pGlobalLua, -1)) { | ||
e = "Lua error:"; | ||
e = tr("Lua error:"); |
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.
A separate issue that does still need to be fixed - there needs to be a space after the colon in English. Otherwise the appended error message is appended directly to it! (BTW for French there will also be a space before the colon - but then the French are different that way about punctuation and spaces, « bizarre »!)
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.
Noted as Issue: #2124 ...
QString msg = "[ ERROR ] - Cannot find Lua module rex_pcre.\n" | ||
"Some functions may not be available.\n"; | ||
msg.append(e.c_str()); | ||
QString msg = tr("[ ERROR ] - Cannot find Lua module rex_pcre.\n" |
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.
FTR appending QString
s is less efficient than creating them with all the elements at once, it would have been better here to have changed lines 13501 to 13503 to:
QString msg = tr("[ ERROR ] - Cannot find Lua module rex_pcre.\n"
"Some functions may not be available.\n
"%1").arg(e);
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.
Noted as a general issue as: #2123
@@ -292,7 +292,7 @@ void cTelnet::connectIt(const QString& address, int port) | |||
|
|||
hostName = address; | |||
hostPort = port; | |||
QString server = "[ INFO ] - Looking up the IP address of server:" + address + ":" + QString::number(port) + " ..."; | |||
QString server = tr("[ INFO ] - Looking up the IP address of server:") + address + ":" + QString::number(port) + " ..."; |
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.
The QString::operator+
is the same as QString::append()
{under most circumstances, though there is a workaround that swaps it for QStringBuilder::operator%
IIRC which works more efficiently}. It would have been better to merge all the concatenations into a single instantiation using the QString:arg()
method to drop in address
and port
replaceable arguments...
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.
As above noted as: #2123
@@ -305,7 +305,7 @@ void cTelnet::disconnect() | |||
|
|||
void cTelnet::handle_socket_signal_error() | |||
{ | |||
QString err = "[ ERROR ] - TCP/IP socket ERROR:" % socket.errorString(); | |||
QString err = tr("[ ERROR ] - TCP/IP socket ERROR:") % socket.errorString(); |
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.
Whilst this is a valid use of the QStringBuilder::operator%
it mandates that the error message is tacked onto the end of the message - it would have been more translatable to use:
QString err = tr("[ ERROR ] - TCP/IP socket ERROR: \"%1\".").arg(socket.errorString());
Notice that there is now a space after the colon which is missing in the original (this is a common feature in the original texts in this PR isn't it! 😝) as well as a terminal .
. It also allows the socket.errorString()
to be rearranged (as %1
) within the body of the translated text should that be necessary/desirable for a particular locale/language.
if (mpHost->mServerGUI_Package_version != newVersion) { | ||
QString _smsg = tr("<The server wants to upgrade the GUI to new version '%1'. Uninstalling old version '%2'>") | ||
_smsg = tr("[ INFO ] - The server wants to upgrade the GUI to new version '%1'. Uninstalling old version '%2'.") | ||
.arg(QString::number(newVersion), QString::number(mpHost->mServerGUI_Package_version)); | ||
mpHost->mpConsole->print(_smsg.toLatin1().data()); |
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.
I'm getting DejaVu all over again. It is not valid to used toLatin1()
on a text that contains translations as toLatin1()
will nuke any graphemes that are not part of the Latin1 charset which are going to be present in at least some of the translations! If TConsole::print(...)
requires a std::string
(or const char*
) argument then you must use toUtf8()
instead...
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.
Logged as #2122
@SlySven Could you please file your (valid) comments and requests for improvement as issues of their own, instead of mere comments on an already merged PR? I know it may seem more handy here, because you can comment code lines specifically, and you found these while traversing there, but still... They will easily get lost here, and can't be adressed anymore. Whereas as seperate issues we can ponder, discuss scope and fix them normally when the time comes, so they can be closed of after. |
Okay, have raised three issues that should cover the main points that I noted. |
Brief overview of PR changes/additions
Including many strings for translation, mostly related to connecting and disconnecting a profile.
Removing strings from translations where they are not needed.
Adjusting code to better grasp strings to translate.
Motivation for adding to Mudlet
Reduce English texts in translated Mudlet versions to mostly only texts used internally.
Other info (issues closed, discussion etc)
As discussed in #1964 and #2010 and Crowdin