Is there a way to change the input keyboard layout in a Qt app? I want to be able to input in the same QTextEdit Widget in English and Russian by switching between languages frequently. One option is to have the cyrillic keyboard activated on Windows and switching between input languages using the windows key and the spacebar.
I want to bypass the feature though on the os level and implement it directly in my app by defining a shortcut or a push button to select the input language. The reason being that the end users (Russian speakers) will be using the app on an English language PC and they should not have to fiddle around with OS settings in a foreign language. The keyboards in use have an English layout with additional Cyrillic characters so typing should not be a problem.
I want to ask if there is a direct method (it would make sense to have one, i hope I am just unable to find it). I could overload the keyPressEvent for my widget as a last alternative. I just hope that there is a better way to do it since I am switching between standard languages.
Overriding keyPressEvent.
Returning cyril characters instead of the texts of QKeyEvent.
Making QMenu for switching the language.
for example,
#class QTextEdit
def keyPresEvent(self, event):
if self.isCurrentWritingSystem == "Russian":
#If you use english keyboard...
if event.key() == Qt.Key_A:
tc = self.textCursor()
tc.insertText("ф")
return
... for others ↓
else:
#codes for normal russian keyboard you don't need to do anything.
return super().keyPressEvent(event)
On the other hand, if you use russian keyboard as default.
if self.isCurrentWritingSystem == "English":
#if you use russian keyboard...
if event.key() == Qt.Key_A:
tc = self.textCursor()
tc.insertText("a")
return
else:
#codes for normal english keyboard. you don't need to do anything.
return super().keyPressEvent(event)
My app (OS X and iOS) is developed in English. I just added a German localisation and everything works well. However, I have now added a call similar to the following
NSLocalizedString(#"run1", #"Run as in 'to run'")
NSLocalizedString(#"run2", #"Run as in 'run it'")
...so I have 2 different variants of 'run'. However, there is no option in XCode6 to 'Export for Localisation (English)' since that's the base language. So how do I get run1 and run2 localised into English? (i.e. run)
I know I can do it by manually creating the .strings file in the en folder - but I was hoping to stick with the xliff workflow.
Thanks
As the iOS have the localization ability, but I would like to have a special localized string, which is not include in the standard localization. May I implement the localized method to switch with localization file? Thanks.
Have you tried to use NSUserDeafaults?
In some view (maybe "myProperties") create an array with Localizations (maybe "English, Russian, German") and choose on of it.
Then, in some view6 where you need to set localization, take it from your properties...
oh, I think, each property contains different values of TimeInterval for localTimeZone, and maybe some button.textLabels for your localized design...
Sorry for my English ((
Is there a way to turn off the automatic text translation at the MSDN library pages ?
I do prefer English text but due to having a German IP address Microsoft activates the automatic translation on every new page load which gives me a yellow box with a German translation of the text I am currently hovering over with the mouse.
This happens regardless what language is initially set in the right upper corner and regardless of whether I am logged in or not.
I can't tell how annoying this is !!
Any ideas, anyone ?
When you hit the "Original" radio button at the top, you see English, with German in the yellow hover box.
If you visit the original English site, you don't see a translation, not even on hover.
You switch to English by replacing /de-de/ in the URL with /en-us/. As in
German (translation or original with translation on hover):
http://msdn.microsoft.com/de-de/library/system.diagnostics.contracts.contractargumentvalidatorattribute(v=vs.110).aspx
English only (no translation):
http://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contractargumentvalidatorattribute(v=vs.110).aspx
If you are a firefox user, you can use Redirector addon. Create a new redirect and set it up like this:
It will automatically redirect all msdn requests to english non-translated versions.
Found it! I mean, it's 2016, 3 years late, and maybe they just added it recently, but when you scroll all the way down there's a small button in the left bottom corner where you can choose language you want to use (more specifically a country "you're from").
MSDN uses the prefered language from your web browser settings.
http://social.msdn.microsoft.com/Forums/en-US/6543407d-f743-48fb-965b-b8af9f9a0cb1/howto-disable-automatic-translation-into-german?forum=msdnfeedback
This is due to the Accept-Language header:
http://www.w3.org/International/questions/qa-accept-lang-locales
So setting your browser to prefer English language websites should fix this problem. W3C has an overview how to do that on different browsers here:
http://www.w3.org/International/questions/qa-lang-priorities.en.php
There is a chrome addon aswell
Switcheroo-Redirector
I got tired of replacing manually the url of the MSDN docs to target en-us in the url, so I came up with this little user script for the very handy Tampermonkey extension (available on Chrome, Microsoft Edge, Opera, and Firefox)
// ==UserScript==
// #name MSDN docs [en-us] redirect
// #version 0.1
// #description Redirects to the en-us version of the current MSDN doc page
// #grant none
// #match https://learn.microsoft.com/*
// ==/UserScript==
(function () {
let pathname = window.location.pathname.split('/');
if (pathname[1].toLowerCase() !== 'en-us') {
pathname[1] = 'en-us';
pathname = pathname.join('/');
window.location.href = window.location.origin + pathname + window.location.search;
}
})();
Once you have the extension installed,
Click on its icon
Click on Create a new script...
Paste the previous code
Save it (Ctrl + S or File > Save).
Test the redirection: https://learn.microsoft.com/fr-fr/dotnet/csharp/programming-guide/classes-and-structs/classes
The #match property will ensure that this script is only run against MSDN doc pages.
Recently I came across the same problem. And I solved it with Chrome extension ModHeader.
I configured and it works:
I know it's an old question, by maybe this insight will be useful to someone.
I almost always open msdn through a search in google. It most of the time offered me site translated to my local language (through a part of the address with locale), sometimes accompanied by original (English) version next to it. If I click on the original language link, it does not translate anything, so it is not automatic translation based on my localization.
What solved my problem was to change google search settings to prefer English, rather than my native language. Go to google search settings, set Which language should Google products use? to English, then in Currently showing search results in: click Edit and check other languages you are likely to search in.
It will also change the UI language for google. I know it might be a high price to pay, but I believe it is worth it. If you search for a query typed in given language, results will most likely result in this language pages anyway.
Instead of extensions, which will consume memory and are a bit overkill for that kind of thing, you can use a custom search query.
Chrome
Settings => Manage Search Engines, add this entry:
Engine: MSDN US
Keyword: ms
URL: https://social.msdn.microsoft.com/Search/en-US?query=%s (or whatever the proper url is at the time of your reading, just use %s wherever it needs the actual query string)
Now, in the address bar, just type ms [SPACE]. As soon as you press the space, it will prompt you with Search on MSDN US:. Just type your query now. For instance ms string will redirect you to the MSDN-US version of the search results for string. Of course you can change the title and keyword.
I'm sure the other common browsers expose that kind of functionality too. On Firefox, I used to plug custom search engines on the search bar.
This is a neat trick that I use for all kinds of searches (SO, Amazon, Wikipedia in different languages, etc.). It's very efficient.
Usually there is a language link at the bottom of the page where you can change language (even though a permanent site specific setting would be much nicer).
In IE in Internet Options Panel you have Apperrance part in General Tab. Add preffered language as a first and from now on all pages from MSDN will be presented in choosen language
I'm using NoScript addon with Firefox (actually Waterfox), just forbib "m-msft.com", the translator will be turned off. I think you can use other plugins in other browser to forbid the domain too. NoScript is a must have addon for any serious web user, and UserStyles, of course.
I created a Swedish localization of my storyboard, but it doesn't get loaded for iOS devices with the language set to Swedish - it's always the English version.
I have Localizable.strings in sv.lproj, and those do work when using the NSLocalizedString macro.
Are there some additional steps required? All I did was click the plus sign under the "Localization" section.
There are no additional steps required except that when you get be ready to start working on localization (i. e. the storyboard is ready on your main application language), you should add localization to your project
and localize Storyboard for each language