i18n and some minor corrections #10

Merged
deloptes merged 1 commits from feat/i18n into master 1 year ago
Collaborator

Signed-off-by: Emanoil Kotsev deloptes@gmail.com

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
deloptes added 1 commit 1 year ago
b797a22993
i18n and some minor corrections
deloptes requested review from SlavekB 1 year ago
deloptes requested review from MicheleC 1 year ago
SlavekB requested changes 1 year ago
SlavekB left a comment
Owner

Good work. However, you can find some comments here.

Good work. However, you can find some comments here.
TQDateTime date = TQDateTime::currentDateTime();
TQString user = "n/a";
TQString iconName = i18n("unknown");
SlavekB commented 1 year ago
Owner

This seems wrong to me. I assume that according to the returned value, the relevant icon is selected for display => it is expected that the name corresponds to the files of icons and therefore not translated as a string.

This seems wrong to me. I assume that according to the returned value, the relevant icon is selected for display => it is expected that the name corresponds to the files of icons and therefore not translated as a string.
deloptes marked this conversation as resolved
}
if (args->isSet("iconName"))
{
std::cout << i18n(iconName.local8Bit()).local8Bit() << " ";
SlavekB commented 1 year ago
Owner

The same as the previous one. At the same time, you may notice that this will potentially try to translate the already translated string unknown.

The same as the previous one. At the same time, you may notice that this will potentially try to translate the already translated string _unknown_.
deloptes marked this conversation as resolved
}
if (args->isSet("linkdest"))
{
std::cout << i18n(linkDest.local8Bit()).local8Bit() << " ";
SlavekB commented 1 year ago
Owner

I assume that this is the name of the target file / directory referred to by symlink. In this case, it is not desirable to attempt to translate.

I assume that this is the name of the target file / directory referred to by symlink. In this case, it is not desirable to attempt to translate.
deloptes marked this conversation as resolved
}
if (args->isSet("name"))
{
std::cout << i18n(name.local8Bit()).local8Bit() << " ";
SlavekB commented 1 year ago
Owner

I suppose this is the name of the file / directory. In this case, it is not desirable to attempt to translate.

I suppose this is the name of the file / directory. In this case, it is not desirable to attempt to translate.
deloptes marked this conversation as resolved
}
if (args->isSet("xmlproperties"))
{
std::cout << i18n(xmlProperties.local8Bit()).local8Bit() << " ";
SlavekB commented 1 year ago
Owner

It is likely that this is not desirable to attempt to translate.

It is likely that this is not desirable to attempt to translate.
deloptes marked this conversation as resolved
}
if (args->isSet("extra"))
{
std::cout << i18n(extra.local8Bit()).local8Bit() << " ";
SlavekB commented 1 year ago
Owner

It is likely that this is not desirable to attempt to translate.

It is likely that this is not desirable to attempt to translate.
deloptes marked this conversation as resolved
{
if (msg != lastMessage && args->isSet("messages"))
{
std::cerr << " >" << i18n(msg.local8Bit()).local8Bit() << std::endl;
SlavekB commented 1 year ago
Owner

Function i18n(...) expects the input string in UTF-8, not local8bit.

Function `i18n(...)` expects the input string in UTF-8, not local8bit.
SlavekB commented 1 year ago
Owner

I believe that the use of i18n() in these cases is not wanted. It is not clear here what the msg will contain, and therefore in this application such a msg is not part of the translation catalog => call i18n() does not make sense inside a slot. If the message is to be translated, then call i18n() should be made on the side that causes invacation of the slot.

I believe that the use of `i18n()` in these cases is not wanted. It is not clear here what the `msg` will contain, and therefore in this application such a `msg` is not part of the translation catalog => call `i18n()` does not make sense inside a slot. If the message is to be translated, then call `i18n()` should be made on the side that causes invacation of the slot.
SlavekB marked this conversation as resolved
{
if (job->error() != 0)
{
std::cerr << i18n(job->errorString().local8Bit()).local8Bit() << std::endl;
SlavekB commented 1 year ago
Owner

Function i18n(...) expects the input string in UTF-8, not local8bit.

Function `i18n(...)` expects the input string in UTF-8, not local8bit.
SlavekB marked this conversation as resolved
void CommandHandler::exitPrintUsage(const TQString& message)
{
std::cout << i18n(message.local8Bit()).local8Bit() << std::endl;
SlavekB commented 1 year ago
Owner

Function i18n(...) expects the input string in UTF-8, not local8bit.

Function `i18n(...)` expects the input string in UTF-8, not local8bit.
SlavekB marked this conversation as resolved
if (!mClient->RemoveSession(mSessionPath, dbuserror))
{
if (dbuserror.isValid())
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, i18n(dbuserror.message().local8Bit()));
SlavekB commented 1 year ago
Owner

I didn't look at it in detail, but the call local8bit() seems wrong to me.

I didn't look at it in detail, but the call `local8bit()` seems wrong to me.
Poster
Collaborator

it did not want to compile without it :(

I will force push now with the changes also mentioned above - I agree - I did it automatically and did not think to much that in this case it is not desired.

it did not want to compile without it :( I will force push now with the changes also mentioned above - I agree - I did it automatically and did not think to much that in this case it is not desired.
SlavekB commented 1 year ago
Owner

Actually, there is another question: Where do these error messages come from? Where do these texts have the opportunity to become a part of the translation template? On closer look, it seems to me that all these occurrences trying to translate unknown content of property are not desirable.

Either the messages are already translated by the one who returns them or it is not possible to translate their content because they are not part of the translation template.

This also applies to cases such as i18n(msg.utf8()).local8Bit() above.

Actually, there is another question: Where do these error messages come from? Where do these texts have the opportunity to become a part of the translation template? On closer look, it seems to me that all these occurrences trying to translate unknown content of property are not desirable. Either the messages are already translated by the one who returns them or it is not possible to translate their content because they are not part of the translation template. This also applies to cases such as `i18n(msg.utf8()).local8Bit()` above.
Poster
Collaborator

tdeio_obex is intended to be used either in konqueror (as extention) or in the command line utility tdebluezioclient

The commandhandler.cpp is the implementation for tdebluezioclient.

I hope this helps

tdeio_obex is intended to be used either in konqueror (as extention) or in the command line utility tdebluezioclient The commandhandler.cpp is the implementation for tdebluezioclient. I hope this helps
SlavekB commented 1 year ago
Owner

What I meant that the message would arise in the application on the opposite side of the dbus interface, and that this application should take care of whether the message will be translated. On our side of the recipient we cannot know what messages we get and therefore we cannot ensure their translations.

What I meant that the message would arise in the application on the opposite side of the dbus interface, and that this application should take care of whether the message will be translated. On our side of the recipient we cannot know what messages we get and therefore we cannot ensure their translations.
Poster
Collaborator

OK, this is valid point. I will look forward to go through the changes and evaluate the context. So where the the messages are to be used locally, we translate and where send to the remote part, we don't. This makes sense.

thanks

OK, this is valid point. I will look forward to go through the changes and evaluate the context. So where the the messages are to be used locally, we translate and where send to the remote part, we don't. This makes sense. thanks
deloptes marked this conversation as resolved
deloptes added 1 commit 1 year ago
6837f7dde6
i18n and some minor corrections
SlavekB requested changes 1 year ago
SlavekB left a comment
Owner

There are other little things.
See the comments below.

There are other little things. See the comments below.
"ConnectionError", i18n("AsyncErrorResponseDetected: %1\n%2\n%3")
.arg(error.type())
.arg(error.name().local8Bit().data())
.arg(error.message().local8Bit().data()));
SlavekB commented 1 year ago
Owner

Now I have noticed – these strings become part of the message that is displayed using KNotify and is TQString in UTF-8. Therefore .local8Bit().data() looks like unwanted.

Now I have noticed – these strings become part of the message that is displayed using KNotify and is TQString in UTF-8. Therefore `.local8Bit().data()` looks like unwanted.
deloptes marked this conversation as resolved
"ConnectionError", i18n("AsyncErrorResponseDetected: %1\n%2\n%3")
.arg(dbuserr.type())
.arg(dbuserr.name().local8Bit().data())
.arg(dbuserr.message().local8Bit().data()));
SlavekB commented 1 year ago
Owner

The same case as above – .local8Bit().data() looks like unwanted.

The same case as above – `.local8Bit().data()` looks like unwanted.
deloptes marked this conversation as resolved
deloptes added 1 commit 1 year ago
352b2a3e03
i18n corrections
deloptes requested review from SlavekB 1 year ago
Poster
Collaborator

@SlavekB
interestingly, I just noticed that it complains about the type, but compiles

this is why I had to use .local8Bit().data() there

./src/tdebluez/devicewizard.cpp: In member function ‘void DeviceWizard::slotAsyncErrorResponseDetected(int, TQT_DBusError)’:
../src/tdebluez/devicewizard.cpp:741:51: warning: format ‘%s’ expects argument of type ‘char*’, but argument 4 has type ‘TQString’ [-Wformat=]
  741 |     tqDebug("AsyncErrorResponseDetected (%i): %i %s %s", asyncCallId, dbuserr.type(), dbuserr.name(), dbuserr.message());
@SlavekB interestingly, I just noticed that it complains about the type, but compiles this is why I had to use .local8Bit().data() there ``` ./src/tdebluez/devicewizard.cpp: In member function ‘void DeviceWizard::slotAsyncErrorResponseDetected(int, TQT_DBusError)’: ../src/tdebluez/devicewizard.cpp:741:51: warning: format ‘%s’ expects argument of type ‘char*’, but argument 4 has type ‘TQString’ [-Wformat=] 741 | tqDebug("AsyncErrorResponseDetected (%i): %i %s %s", asyncCallId, dbuserr.type(), dbuserr.name(), dbuserr.message()); ```
Owner

@SlavekB
interestingly, I just noticed that it complains about the type, but compiles

There are three types of tqDebug() calls. One takes a const char*, one a TQCString and one a TQString.
The one you are using is the const char* type, so you need to pass a const char* to a %s argument. dbuserr.name() returns a TQString, which is not implicitly converted to const cahr*, hence the need to use .local8Bit().data().
Alternatively, you can use the version that takes a TQString, but with many parameters to conactenate it becames less readable.

> @SlavekB > interestingly, I just noticed that it complains about the type, but compiles There are three types of tqDebug() calls. One takes a const char*, one a TQCString and one a TQString. The one you are using is the const char* type, so you need to pass a const char* to a %s argument. dbuserr.name() returns a TQString, which is not implicitly converted to const cahr*, hence the need to use .local8Bit().data(). Alternatively, you can use the version that takes a TQString, but with many parameters to conactenate it becames less readable.
deloptes force-pushed feat/i18n from 352b2a3e03 to 593ca27e2b 1 year ago
SlavekB requested changes 1 year ago
SlavekB left a comment
Owner

There is one small thing and the use of i18n() for unknown messages in slots.

There is one small thing and the use of `i18n()` for unknown messages in slots.
// }
// if (error.isValid())
// tqDebug("Failed in connecting device: %s", error.message().local8Bit().data());
// tqDebug("Failed in connecting device: %s", error.message());
SlavekB commented 1 year ago
Owner

.local8Bit().data() is removed, but message is not wrapped in i18n().

`.local8Bit().data()` is removed, but message is not wrapped in `i18n()`.
Poster
Collaborator

See my last commit.

See my last commit.
SlavekB commented 1 year ago
Owner

Yes, now it looks good. Please pay attention to the comment 24068 on src/tdebluezioclient/commandhandler.cpp.

Yes, now it looks good. Please pay attention to the comment [24068](pulls/10#issuecomment-24068) on src/tdebluezioclient/commandhandler.cpp.
Poster
Collaborator

yes, indeed I now removed translation of these messages (see last commit). As far as I understand i18n provides the strings that are translated in weblate. So it does not make any sense to as i18n to translate something we do not know.

Let me know if you find anything else or if I am wrong in my understanding. And thank you, I learned a lot now. I hope I do not forget it soon.

yes, indeed I now removed translation of these messages (see last commit). As far as I understand i18n provides the strings that are translated in weblate. So it does not make any sense to as i18n to translate something we do not know. Let me know if you find anything else or if I am wrong in my understanding. And thank you, I learned a lot now. I hope I do not forget it soon.
SlavekB marked this conversation as resolved
deloptes added 1 commit 1 year ago
fbb7355399
i18n corrections corrections
deloptes added 1 commit 1 year ago
35d3d4f57b
i18n corrections corrections corrections
SlavekB reviewed 1 year ago
SlavekB left a comment
Owner

After corrections corrections corrections it looks good good good 😺.
It's time to make squash commits and then we can move forward and merge it.

After corrections corrections corrections it looks good good good 😺. It's time to make squash commits and then we can move forward and merge it.
deloptes force-pushed feat/i18n from 35d3d4f57b to b064e1e200 1 year ago
Poster
Collaborator

After corrections corrections corrections it looks good good good 😺.
It's time to make squash commits and then we can move forward and merge it.

glad to see a smile on your face.

squashed and force-pushed.

BR

> After corrections corrections corrections it looks good good good 😺. > It's time to make squash commits and then we can move forward and merge it. glad to see a smile on your face. squashed and force-pushed. BR
deloptes force-pushed feat/i18n from b064e1e200 to c95a429826 1 year ago
deloptes merged commit c95a429826 into master 1 year ago
deloptes deleted branch feat/i18n 1 year ago
MicheleC added this to the R14.1.0 release milestone 1 year ago
SlavekB approved these changes 1 year ago
SlavekB left a comment
Owner

After squash all looks good...
...and already merged 😸

After squash all looks good... ...and already merged 😸

Reviewers

MicheleC was requested for review 1 year ago
SlavekB approved these changes 1 year ago
The pull request has been merged as c95a429826.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdebluez#10
Loading…
There is no content yet.