{"action":"created","issue":{"url":"https://api.github.com/repos/edbee/edbee-lib/issues/55","repository_url":"https://api.github.com/repos/edbee/edbee-lib","labels_url":"https://api.github.com/repos/edbee/edbee-lib/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/edbee/edbee-lib/issues/55/comments","events_url":"https://api.github.com/repos/edbee/edbee-lib/issues/55/events","html_url":"https://github.com/edbee/edbee-lib/issues/55","id":258194214,"number":55,"title":"Request for conversion of QString(\"raw string\") to QStringLiteral() or tr() methods","user":{"login":"SlySven","id":6163092,"avatar_url":"https://avatars3.githubusercontent.com/u/6163092?v=4","gravatar_id":"","url":"https://api.github.com/users/SlySven","html_url":"https://github.com/SlySven","followers_url":"https://api.github.com/users/SlySven/followers","following_url":"https://api.github.com/users/SlySven/following{/other_user}","gists_url":"https://api.github.com/users/SlySven/gists{/gist_id}","starred_url":"https://api.github.com/users/SlySven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SlySven/subscriptions","organizations_url":"https://api.github.com/users/SlySven/orgs","repos_url":"https://api.github.com/users/SlySven/repos","events_url":"https://api.github.com/users/SlySven/events{/privacy}","received_events_url":"https://api.github.com/users/SlySven/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"gamecreature","id":577933,"avatar_url":"https://avatars2.githubusercontent.com/u/577933?v=4","gravatar_id":"","url":"https://api.github.com/users/gamecreature","html_url":"https://github.com/gamecreature","followers_url":"https://api.github.com/users/gamecreature/followers","following_url":"https://api.github.com/users/gamecreature/following{/other_user}","gists_url":"https://api.github.com/users/gamecreature/gists{/gist_id}","starred_url":"https://api.github.com/users/gamecreature/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamecreature/subscriptions","organizations_url":"https://api.github.com/users/gamecreature/orgs","repos_url":"https://api.github.com/users/gamecreature/repos","events_url":"https://api.github.com/users/gamecreature/events{/privacy}","received_events_url":"https://api.github.com/users/gamecreature/received_events","type":"User","site_admin":false},"assignees":[{"login":"gamecreature","id":577933,"avatar_url":"https://avatars2.githubusercontent.com/u/577933?v=4","gravatar_id":"","url":"https://api.github.com/users/gamecreature","html_url":"https://github.com/gamecreature","followers_url":"https://api.github.com/users/gamecreature/followers","following_url":"https://api.github.com/users/gamecreature/following{/other_user}","gists_url":"https://api.github.com/users/gamecreature/gists{/gist_id}","starred_url":"https://api.github.com/users/gamecreature/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamecreature/subscriptions","organizations_url":"https://api.github.com/users/gamecreature/orgs","repos_url":"https://api.github.com/users/gamecreature/repos","events_url":"https://api.github.com/users/gamecreature/events{/privacy}","received_events_url":"https://api.github.com/users/gamecreature/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2017-09-16T00:26:16Z","updated_at":"2017-09-17T19:53:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Following on from #54 may I ask if it is possible to go through the whole `edbee-lib` library and convert all the uses of `QString(\"some string possibly with %1 or more variable argument replacement\").arg(1)` to use either the:\r\n+ `QStringLiteral(...)` form if the string is used internally and not user visible\r\n+ `tr(...)` form if it will be user visible and require translation for use in non __English(American)__ locales\r\n\r\nWhere a non-user visible constant `QString` is used as an argument to a function/method where a `QLatin1String` is a valid argument type the alternative `QLatin1String(...)` is also viable but it does not support the `%1`-`%9` type variable (positional) replacement arguments that `QStringLiteral(...)` does.\r\n\r\nIdeally for the second type above if the string is a form where plurals are significant e.g. \"You have just deleted X paragraph(s).\" it would be best if the `%n` form is used, i.e.:\r\n\r\n    tr(\"You have just deleted %n paragraph(s).\", \"\", variableContainingValueForX)\r\n\r\nI am requesting this because I am working on several aspects of __[I18n](https://en.wikipedia.org/wiki/Internationalization_and_localization)__ for the [Mudlet](https://github.com/mudlet/mudlet.git) project and in the near future I wish to add (run-time) GUI language selection (i.e. the user interface will be changeable to use another language) and part of that will use the Qt system for doing that which uses `QObject::tr()`; `QCoreApplication::translate()` or `QApplication::translate()` in C++ code to provide previously created translated versions of the (presumably \"EN-us\" or English{American})  source code strings.  Obviously it would be beneficial if the editor can also support such a language change {ideally it will respond to receipt of `QEvent::LanguageChange` events to recreate any affected persistent texts - by regenerated them by reusing `tr(...)` but for strings that are frequently changed anyway e.g. status-lines it probably will not need that level of coding and things will work well enough just by using `tr(...)` each time such a string is modified}. \r\n\r\n_\\<aside> This is where `#define QT_NO_CAST_FROM_ASCII` is useful - if the macro is present in the source code it will cause any `QString` initialisations from raw strings to fail to compile (the compiler will moan about the constructor being private and thus inaccessible) and allow them to be pin-pointed and \"fixed\"...\\</aside>_"},"comment":{"url":"https://api.github.com/repos/edbee/edbee-lib/issues/comments/330078894","html_url":"https://github.com/edbee/edbee-lib/issues/55#issuecomment-330078894","issue_url":"https://api.github.com/repos/edbee/edbee-lib/issues/55","id":330078894,"user":{"login":"SlySven","id":6163092,"avatar_url":"https://avatars3.githubusercontent.com/u/6163092?v=4","gravatar_id":"","url":"https://api.github.com/users/SlySven","html_url":"https://github.com/SlySven","followers_url":"https://api.github.com/users/SlySven/followers","following_url":"https://api.github.com/users/SlySven/following{/other_user}","gists_url":"https://api.github.com/users/SlySven/gists{/gist_id}","starred_url":"https://api.github.com/users/SlySven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SlySven/subscriptions","organizations_url":"https://api.github.com/users/SlySven/orgs","repos_url":"https://api.github.com/users/SlySven/repos","events_url":"https://api.github.com/users/SlySven/events{/privacy}","received_events_url":"https://api.github.com/users/SlySven/received_events","type":"User","site_admin":false},"created_at":"2017-09-17T19:53:42Z","updated_at":"2017-09-17T19:53:42Z","author_association":"CONTRIBUTOR","body":"I was initially surprised how few of those strings count as _User-visible_ and thus need translation for other languages but then as an editor widget I realised it was all about the users' text and really only help or warning messages would be seen from the widget itself...! 😮\r\n\r\nOne thing to be careful of where they are with `tr(...)` or `translate(...)` is to avoid building up sentences by appending fragments a bit at a time - that may not be workable where the order of those fragments actually need to change depending on the language - I am sure the Qt Documentation for their translation systems actually gives some examples of this but I cannot track them down right now - one example I recall which compares the order of a couple of replacement variables (e.g. `%1` and `%2`) and showing how they have to be the opposite order in Norwegian compared to English!"}}
{"actor":{"display_login":"SlySven"}}