Testing Firefox Add-on/Extension Internationalization - firefox

I have created a Firefox Add-on using jpm and I have added a number of localization files such as:
locale/da.properties
locale/en-GB.properties
locale/en-US.properties
locale/fi.properties
And so on...
In my HTML files I use attributes to set these values, for example: data-l10n-id="ext_panel_heading_text".
I know the translations are working, because changes I make to values in en-GB.properties are reflected in my add-ons HTML page.
I've tried navigating to Options > Content > Choose... (under languages), removing English and adding another language (such as Finnish), however it doesn't seem to have an affect on the .properties file loaded by my extension. I also tried restarting Firefox after changing the language.
My question is: How do I test the different languages?

The language of Firefox is dependent on the activated language pack, or for Windows and Mac I believe it is hard coded into the build.
Language packs are available from https://addons.mozilla.org/en-US/firefox/language-tools/

The only way I know is to change general.useragent.locale to the locale you want to use (en-GB, da, en-US, fi) in about:configand then restarting your browser: that way your add-on should show localized texts.
As an alternative, you can use Quick Locale Switcher, which does the same but it's a little more friendly.

Related

Alter Multilingual App Toolkit source language

So I understand how Multilingual App Toolkit 4.0 works and it works great for my Xamarin.Android project. The default language is English, and with MAT we've translated it to Dutch and German.
Then comes the translator along and asks about how to make changes to the English texts, which is my source texts and the basis of all translations. The source texts (English) are in a file Resources\values\Strings.xml. Alter a string there, would invalidate all translations (Dutch and German).
Besides invalidation, I can't send my translator the normal .xlf file, because all source texts are in the Strings.xml file.
So my question is, how can my translator alter the source language texts in the most easy way (preferably with an .xlf file)?
The short answer is that you can't. The design of the Multilingual App Toolkit focused on providing easy support for translation into other languages. The concept of providing source content editing was not considered.
That said, as a workaround you could add another variant of English. For Android apps, the default is English Neutral (en), so adding en-US or en-UK would create the XLIFF file that your translator / proofer could edit using the same tooling (e.g.: Multilingual Editor) to provide source content proofing. If using the same translator for proofing and translating, they could apply the translation based on the update English string to the Dutch and German files.
When you receive the XLF files back ensure all the resource in the proofing English XLF (e.g.: en-US) are marked as need review, translated or final (basically anything except 'New'). The reason is that the Multilingual App Toolkit does not include untranslated resource in the generated target resource file. (The reason is for language fallback purposes in Windows apps).
Now you can import the proofed English file with the other XLF file and build. Copy the entire contents from the proofed English resource file(s) overtop the original source files (recommend Comparing first). When you next build, you will receive warnings that the source resources have changed after the translation, but you can just review and clear those warning in the editor, or clear them globally within the Visual Studio IDE.

Sass (source maps) support in Firefox Developer Tools

With the release of Firefox 25 we saw a huge improvement in their development tools. SO much so that I'm rather excited to try them out over Firebug.
However I can't see how to turn on Sass debugging, which is currently working in Firebug. I've looked in all the settings that are offered within the development settings.
I'm hoping I'm wrong and it is currently supported.
With Firefox 29 the support for Sass and LESS files was introduced.
Taken from https://hacks.mozilla.org/2014/02/live-editing-sass-and-less-in-the-firefox-developer-tools/
You have to right-click in the Rules section and activate Show original sources option:
Now CSS rule links will show the location in the original file, and
clicking these links will take you to the source in the Style Editor.
From there you can go on to the Styles Editor and edit your Sass/LESS file. Functionality needs Source Maps enabled!
The best suitable way to debug Sass in Firefox seems to be FireSass.
https://addons.mozilla.org/en-US/firefox/addon/firesass-for-firebug/

ActiveX component to display in-memory MHTML in Windows

I'm creating a small Windows application (C++) which create some windows an such (CreateWindowEx and the like). And in one window I want to add a control that shows MHTML loaded from memory, i.e. the whole MHTML content is in a string, not in a file.
I already tried the Shell.Explorer component, but I can't find a way to inject to it anything other than HTML (see AtlAxCreateControl).
Is it possible to use the Shell.Explorer component or any other to show in-memory MHTML??
That is, without writing the content to a file and then giving the file path. That works, but it's not optimal and it'll have to be the last alternative if I can't do it any other way.
PS: If this can be done in another language or environment like C#, JS, VBS, WSH, HTAs, I'm all ears as well.
A bit late to answer, but still - there is a way to do it : use Microsoft's WebBrowser control (COM component, can be used in .Net apps as well).
Take a look an what the proposed solutions here - How to load mht from stream/string into a WebBrowser control? and here - How to display the string html contents into webbrowser control?. some of them refer to mhtml content but the solutions are applicable to ordinary html files as well.
Good luck.

Hack Firefox to open extensions with address bar

I see this one time, and know that it not so hard, but can't find any solutions in internet.
Let say I have plugin, as you know it written by XUL. XUL like HTML has tags, js and etc. So I want to debug it with Firebug.
But in default plugin view firebug (as all other plugins disabled). So i need to open my plugin like Web page.
I remember that it's something like
chrome://address/to/my/plugin/page.xul
Does anyone face this problem?
There is no general rule by which you can build the addresses of extension pages. You have to open the extension's XPI file (it's a regular ZIP file, rename it if necessary) and have a look at chrome.manifest inside. E.g. in Firebug's chrome.manifest it says:
content firebug content/firebug/
Which means that the files in the content/firebug/ directory of the extension are accessible under chrome://firebug/content/. You can try opening them as web pages but they won't necessarily work.
A better approach would be using tools that are actually meant for extensions. For example Chromebug or DOM Inspector.

how to debug vb6 richtextbox not showing unicode (chinese) properly

I have a simple vb6 editor type application which has a richtextbox as the editor page. It allows users to key in stuff and the store it into a file which will keep all the text in RTF stored as CDATA in xml.
When you load back the file, it will read it off the xml and load back the rtf. We allow for unicode editing, but my problem is I have a user which is using Windows XP, and they have some problems reading the chinese characters. They show up as gibberish in their pc.
It displays fine in both mine and a coworker's. I've already checked that they have the proper regional language and settings in their system. The install files for east asian language is already checked. And they can see chinese words on websites and even type them out.
I feel like I'm missing something here but I'm at a lost on what to check next? Any ideas on what I could test or check next?
my bad for the poor description skills, if anything is not clear just ask me.
thanks.
~steve
That is weird. Try confirming that your user have the same version of RICHTXT32.OCX ?
Could be a problem with font?
Try using font that supports unicode characters (Arial Unicode).
Or try going to a website with chinese characters and paste it into richtextbox, save it to a file and try loading it from the file.
Does that work?
well they should because i packed the app in vs installer setup package.
and for fonts, it's sim sun, and i've already checked with the users that they do have the sim sun fonts under window/fonts.
Btw i've already updated that the data is actually stored in xml under CDATA, although the rtf chunk is kept as it is.
okie, this seems to be the solution although i don't know why. in my msi setup file i've included the riched.dll so when i installed it in, the dll acts up and screw up my chinese character in the richtext control.
but when i repack to exclude that dll file and reinstall using that setup, it seems to work now...

Resources