VB.NET localization, detect untranslated text - vb.net

I'm working on a project, where the localization is mostly done using resource files/cultures. If a translation does not exist for the language, the default language is used.
I recently received the task of reviewing some problems with the translation. Some text is in the default language, some not. Why it has not been translated is not always obvious, as there are cases when the resource files are not used, or have not been translated. I would love to be able to see what is the case without having to check the code.
What I would like to have is that everytime the fallback language is used instead of the requested language, that the text gets a "*" in front of it. this would enable me to know when simply a translation is missing in the resource file. So far I have not found a way to do this.

You can use Zeta resource editor (open source) to easy match all resource strings and even complete them if necessary.

Related

VB.NET Localization of strings

I've been successful in using form.location.resx files to localize the strings associated with form controls. However, I don't see how to (safely!) add strings to the .resx file(s) and then access them for such things as message boxes.
If I try to add a string to the .resx file using Visual Studio (2017), I get a warning dialog pop-up telling me that this could corrupt the "project item" (form) or my changes could be lost if I change the associated form.
Also, if I use this method, would I need to manually add my strings to each language file separately?
Alternatively, I could create a bunch of Labels to the form with visible=false and then edit their strings in the .resx files and use something like:
msgbox(LabelSampleMessage.text,MsgBoxStyle.Information,LabelSampleMessage2.text)
But that seems like it would be massively inefficient.
For Windows Forms, the best way to do this is to go into the Designer and set the Language property on the form. This will create a formName.Designer.languagecode.resx file for you. Then you just edit the Text properties of the controls. The changes will go to the resx file for the language you're editing. You can even have different layout and control spacing for each language (useful if a label is short in English but translates to something long in German).
For MessageBox messages, you do the same thing with the Resources.resx file. Just put all the messages in your Resources and duplicate the resx file for each language. Then use the Resource editor to translate the message in the other languages. You can then look up the message using My.Resources.Default.SomeMessageKey
#David: Note that I'm the author of a commercial ".resx" localization program for VS (in the interest of full disclosure). Yes, dwilliss is correct, though the names he used are a little off. For Windows forms, you can't manually update the ".resx" files yourself (directly), hence the warning from VS (don't know why they did things this way - go figure). You won't get that warning for strings you put in "Resources.resx" however. Just manually add "Resources.[LangCode].resx" and update it on your own. You have to add the keys yourself (again, no warnings). You can then simply access each string via the static properties seen in the "code-behind" file "Resources.Designer.cs" (one static property exists for each string you add). These are what MSFT calls "strongly typed" resources. If you access, say, "YourApp.Properties.Resources.SomeMessage" for instance (from "Resources.Designer.cs"), it will be returned in whatever language is currently set in "System.Threading.Thread.CurrentThread.CurrentUICulture" (assuming that language's satellite assembly is installed of course). This is all a pain and highly error-prone for other reasons as well, hence the reason I wrote my program (shameless plug but MSFT's way does work, though it's very primitive for handling translation in general - a professional organization relying on an external translator will save a lot of problems and $ in the long run by using a 3rd-party translation program, not mine necessarily though it would be my tool of choice of course, but anything is better than handling it manually).

Atom Syntax Grammar Names

I am working on a Language Package in Atom and am curious about how to name items. For some reason, things like keyword.operator.langname as the name, yet it still doesn't highlight. I checked the HTML source and the span is there, but no coloring. I even compared my code to other languages code and the styles.less file used in atom and it appears that it should work. What am I doing wrong?
Also, is there any good place that has a list of the selectors as I can't seem to find any docs on them.
The regex I am using for anyone who is curious is:
'match': ':',
'name': 'keyword.operator.langname'
(langname being a psuedonym for the name of the language.)
It's likely that the syntax theme you're using doesn't support it. I know that keyword.operator shows up in language-javascript, but when I look at one-dark-syntax as an example, the coloring for that class combination only exists in language-specific files. I feel like the best path for people designing small language packages is to look in core syntax theme packages to figure out which classes to use. Don't get too hung up on the actual class names, since your user won't see them at all unless they look at them in the dev tools.

Localization Windows Phone: Is is possible to change the localized resource at design time?

I created a few resource files for different languages. (E.g. resource.resx, resource.nl-NL.resx etc)
At this moment I only can see the result with the phone emulator. (By changing the language setting in the phone emulator)
For the design phase I want to see the result in different languages at design time. For example Dutch. (Or even better, some pseudo language)
It looks like Visual Studio (2012) and Blend both use the default resource file. (resource.resx)
Is there a way to use another resource file?
I could not find a good solution for this, so I did a very ugly thing. Works but is no fun at all.
I renamed the resource files so that the language I wanted to see had no language suffix (and the original one had a suffix that I know I will not use).
Some caveats:
The original language-neutral resource file has a 'custom tool' property of 'PublicResXFileCodeGenerator' (or equivalent). The resource file that is the new neutral language needs this property. It must be removed later on when we go back to the original situation after testing.
If the language that you want to test did not redefine all strings, you may get some compile-time errors and you need to copy the missing strings from the original neutral resource file.
The only advantage is that there is no need to reboot the emulator to see this language in action.
You can set the CultureInfo property by inserting the following code into the InitializePhoneApplication inside app.xaml.cs
private void InitializePhoneApplication()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK");
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
This will override the culture, so you don't have to change it inside the emulator.

What does (filename.java.i, filename.jar.i) extension mean

I have files named xxx.java.i,xxx.java.d,xxx.jar.i. I know that these file are somehow related to Java. What does this extension mean and for what is it used? Is it same type as the .class extension?
You should look at your build system for more information. It is possible that these are intermediate files that get transformed and renamed to ".java". For example, I've seen various build systems that use the ".i" suffix to mean "input", and perform various forms of variable substitution (e.g. changing something like "{VERSION_NUMBER}" to the version number of the library being compiled).
I think they are created by someone to serve his own purpose and unless we ask the author or see the content we won't know what it the purpose is.
If you see garbled characters, it's probably java bytecode and you can use some decompiler to see the code (see: How do I "decompile" Java class files?).

Batch source-code aware spell check

What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files?
The spell check should be source code aware meaning that it would stick to checking string literals in the code and not the code itself. Bonus points if the spell checker understands common resource file formats, for example text files containing name-value pairs (only check the values). Super-bonus points if you can tell it which parts of an XML DTD or Schema should be checked and which should be ignored.
Many IDEs can do this for the file you are currently working with. The difference in what I am looking for is something that can operate upon a whole source code base at once.
Something like a Findbugs or PMD type tool for mis-spellings would be ideal.
As you mentioned, many IDEs have this functionality already, and one such IDE is Eclipse. However, unlike many other IDEs Eclipse is:
A) open source
B) designed to be programmable
For instance, here's an article on using Eclipse's code formatting functionality from the command line:
http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/
In theory, you should be able to do something similar with it's spell-checking mechanism. I know this isn't exactly what you're looking for, and if there is a program for doing spell-checking in code then obviously that'd be better, but if not then Eclipse may be the next best thing.
This seems little old but seems to do a good job
Source Code Spell Checker