.net Satellite assembly? - c#

How can i create satellite assemblies in .net 3.5?
I have a nativetext.resx file in english and want to create assemblies for french and italian in different folders like
it --> nativetext.resources.dll
fr --> nativetext.resources.dll
is there any too like AutoLocalize.exe(am not sure)

If you are editing a windows forms form, select the choosen form in the designer, set the Localizable property to True, and set the Language property to your choice. Then rewrite the text attributes for the controls. They will be placed in the appropriate resource file and dll-s for each language will be generated.
The forms' language will reflect the OS' MUI setting, or you can change it programatically.
See: MSDN Sample, MSDN Walkthrough, and more (mostly under the "localization" link). This is a complex topic, but simple things can be achieved simply.

Related

Language on Botframework

Im goind through the bot framwork and Im having trouble fixing the global language.
The problem is that I cannot change the backend commands and responses that are built in the framework, they are always in english.
For example, in Formflow, I would like to enter "help" but in other language instead.
Or whenever a question in a QnAbot is not found, I would like the defaul "...Is not a valid query" to be in another lenguage instead
Are different languages built in or do I need to code every commmand translation?
If you’d like to implement localization, you can try to create resource files for language that you want and add&use it in your project. When a form is created, the IFormBuilder.Build method will automatically look for resources that contain your form type name and use them to localize the static strings in your form.
This article describes Localize form content, please refer to it. And you can find these main steps:
Generate a resource file, you can either use IFormBuilder.SaveResources or use the RView tool
After generated a resource file, add it to project and then set the neutral language withe these steps:
Right-click on your project and select Application.
Click Assembly Information.
Select the Neutral Language value that corresponds to the language in which you developed your bot.
After added resource files to project, use the Multilingual App Toolkit (MAT) to localize them.
you can try it by using
var english = new Option();
english.Locale = "en-US";
Reference: GitHub

localize a picturebox image from a resource from a satellite library

I am attempting to write a small program that uses localized resources that depend on the language and culture. You can view a video explanation here.
My two questions are
How can I (from the IDE/Visual Studio) access resources from a satellite DLL
Specifically, how can I access an image for a pictureBox control.
Here are the two Projects:
One is a library and one is a windows form project. I want to reference the resx files from Form1. If this is not the correct way to use this, please explain how I should be creating my satellite DLL.
Here is how I want the Form to look in American Culture:
and here is how I want it to look in Australian Culture:
Please check this page:
http://msdn.microsoft.com/en-us/library/y99d1cd3(v=vs.80).aspx
It is about how to localize a string and from which you will know we use different resource file for different language version.
Here is the description of it from that page:
"In general, you should use forms-based resources for all resources specific to a form in your Windows Forms application. You should use project resources for all non-forms-based user interface strings and images, such as error messages."
Here is way and code about image:
Localization of image resources in Windows Forms
and a step by step solution here:
Proper localization of a WinForms application
I've just completed a C# .Net 3.5 project with a similar problem. We were writing WinForms plugin for an existing multi-lingual application with 8 languages (including English).
This is how we did it:
Create all our forms and UI in the default language, English.
Put all our internal strings in a resource file (stuff not tied directly to a form like custom error messages and dialog box titles etc)
Once we had completed most of the work and testing we localised it.
Each form already had a .resx file but this was empty. We set the property 'Localizable' to true, the .resx file was filled with things like button sizes & strings.
For each of the other languages, we changed the 'Language' property on the form. We chose the basic version of each language eg: 'Spanish' instead of 'Spanish (Chile)' etc. so that it would work for every 'Spanish' dialect, I think.
Then we went through each control, translated its text and resized, if needed. This created a .resx per language and form combination.
We were then left with, for 8 languages, 8 .resx for each form and 8 .resx for the general strings. When compiled the output folder had the .dll we were creating and then a sub folder for each language with a .resources.dll in it.

How can I have my C# Form resources in one DLL, whilst the implementing code is in another DLL?

I have a project that contains a number of DLL files that contain Form resources which all go through translation/localisation (l10n).
For example, a DLL includes SomeForm.cs, which includes plenty of code functionality. The DLL also contains tranlsated versions of SormForm: SomeForm.resx, SomeForm.fr.resx and SomeForm.ja.resx (Default Language, French and Japanese translations).
The localisation group has asked for all of the resources to be placed into one library to reduce their overhead.
How can I move the form resources to a single DLL whilst keeping the code that implements the form in it's current DLL?
I don't want to move the functionality/code to a single DLL, which I think is what's being suggested here: Moving form resource files to a resource dll
Satellite Assemblies
Satellite assemblies are dll's which only contain resource files.
MSDN Article is very confusing. This article should give you a good understanding about the concept.
http://www.codeproject.com/Articles/59193/Localizing-a-Windows-Application-with-Satellite-As
Edit: Dynamic Layout for windows forms.
How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control
Walkthrough: Creating a Layout That Adjusts Proportion for Localization
Code Listing
How to: Design a Windows Forms Layout that Responds Well to Localization

Proper localization of a WinForms application

I have a WinForms application which I want to translate into multiple languages. However, I do not have any experience with localizing a WinForms app, and I find very contradictory information about this subject.
Basically, what I want is:
In the source code, I want only one file per language
This file gets compiled into the main application on compilation - no satellite assemblies or external data files after building the application
The user can select the language, I do not need/want auto-detection based on the operating system
This should mainly contain strings and ints, but also a CultureInfo
Most solutions I've seen either have one .resx file per Form and/or external satellite assemblies.
Do I have to roll my own?
Or is there something in the framework already?
.net Framework 3.5 SP1 if that matters.
Edit:
For the most part, Visual Studio already offers support for what I want, but there are two issues. When I set Form.Localizable to true I have this nice Designer support, but this generates one resx per Form. The idea of manually overriding it in InitializeComponent fails because it's designer-written code that will regularly be overwritten.
Theoretically, I only want to :
a) override the creation of the ComponentResourceManager to point it to my global resx and
b) change the call to ApplyResources to the overload that takes a CultureInfo as third parameter.
It seems as if I have to add a function call to my constructor that gets called after InitializeComponent() and overrides its behaviour. That seems terribly inefficient, but Visual Studio is right when it warns about touching InitializeComponent().
At the moment, I am indeed rolling my own WinForms localization Framework...
I've just completed a C# .Net 3.5 project with a similar problem. We were writing WinForms plugin for an existing multi-lingual application with 8 languages (including English).
This is how we did it:
Create all our forms and UI in the default language, English.
Put all our internal strings in a resource file (stuff not tied directly to a form like custom error messages and dialog box titles etc)
Once we had completed most of the work and testing we localised it.
Each form already had a .resx file but this was empty. We set the property 'Localizable' to true, the .resx file was filled with things like button sizes & strings.
For each of the other languages, we changed the 'Language' property on the form. We chose the basic version of each language eg: 'Spanish' instead of 'Spanish (Chile)' etc. so that it would work for every 'Spanish' dialect, I think.
Then we went through each control, translated its text and resized, if needed. This created a .resx per language and form combination.
We were then left with, for 8 languages, 8 .resx for each form and 8 .resx for the general strings. When compiled the output folder had the .dll we were creating and then a sub folder for each language with a .resources.dll in it.
We were able to test the versions of the UI in the designer by just changing the language property to check that we had the correct strings & layout.
All in all once we got our heads around it, it was quite easy and painless.
We didn't need to write any custom tweaks to the form loading
I was asking a similar question about ASP.NET and got a first answer - this tool and its workflow might also be something for you - have a look: Lingobit Localizer
It seems to be able to load your Winforms app and allows you to start translating your labels etc. and see the forms while you do it. Lots of other features, too, like incremental translation and translation memory (if you use the same terms over and over again).
Looks quite promising (for Winforms) - haven't used it myself, though.
Here's an extensive list of potential .NET localization tools - not sure, how well they work and what they cover - have a look, maybe you'll find what you're looking for.
Marc
I dont have a solution for your first and second requirement but keep in mind that localizing a form is not as simple as translating each word. You need to check that each translated text fits in their respective control. Also, maybe you have an icon or an image which need to be change in another culture.
For your point three, you can change the language manually with the following lines:
CultureInfo ci = new CultureInfo("fr");
Thread.CurrentThread.CurrentUICulture = ci;
This is a huge subject and there are many ways to accomplish what you want. The framework does provide the basis but a complete solution requires that you implement certain elements yourself.
For example the default framework implementation is to create a .resx file for every resource. In ASP.Net this means each user/server control or page. This doesn't lend itself to easy maintenance and if you want to move resources to a database you need to implement your own provider.
My familiarity with Winforms is limited but if you are using Silverlight or WPF then have a read of Guy Smith-Ferrier's work on the subject at: http://www.guysmithferrier.com/category/Internationalization.aspx. He also has some toolsets that can make your life easier at: http://www.dotneti18n.com/Downloads.aspx.
I've worked with him before and have never come across anyone else with a better depth of understanding of the subject.
What you are asking for:
no satellite resource files
only one size and control placement per form.
lots of languages embedded in the executable.
Is not do-able in vanilla Visual Studio's IDE.
What it would require is some custom work, basically fulfilling all these steps:
Acquire a custom resource manager that handles TMX resource files.
Put all your localizable strings in a TMX file.
Make this TMX file an embedded resource in your project.
In your Form constructor, create your TMX ResourceManager, loading the TMX file from your embedded resources.
In your code, use your tmx ResourceManager instead of the default ResourceManager for getting localized strings.
Let the Form use the default ResourceManager for getting all the designer things except the strings.
Get your TMX file fleshed out with the new language translations.
More can be added in the next release of your project, just by adding them to this TMX file before you compile.
RESOURCES: (not an exhaustive list, by any means)
http://en.wikipedia.org/wiki/Translation_Memory_eXchange
http://sourceforge.net/projects/tmx-editor/
The right way to do this is, suppose you want to add Arabic support witch is RightToLeft language:
Double click the form
Set localizable prop. to true
Change Language prop. to Arabic //This will automatically open a new version of the form so you can customize.
Set RightToLeft prop. to Yes
Set RightToLeftLayout prop. to True
Start renaming controls, and save the form.
Handle Messages/Errors in code // Sorry I don't have a quick solution for now, try duplicate them and If/Else the current local.

Why Aren't All My WinForm Controls and Forms Localizing?

Greetings all,
I'm trying to localize a .NET/C# project. I'm using string resource files and setting the "Localizable" property on all my forms to 'True'. The assembly culture is empty. The resx/resource files are successfully passed through Lingobit, resgen, and al.
When running the localized executables, some of my forms are not localized (ones in which I know the Localizable flag is set) while others are. There are even a few forms which are localized but a button or two isn't. I cannot tell any difference between the non-localized forms/controls with the localized ones.
Anyone have an idea what I might be missing? Thanks!
When you open the form in Visual Studio, if you change the Language property of the Form to the language you are localizing to, does the same problem exist there? Could it be possible that the non-localized forms/buttons still have the English text set even in the localized resources?
Yeah, I'd go with Andy on this and be suspicious of the contents of the resource files. We dabbled with localisation for a time, and encountered a number of issues, but this certainly wasn't one of them.
If that isn't it, then how are you testing your app? If you haven't tried this already I'd suggest firing up a set of VMs with foreign language versions of Windows installed (rather than just changing the language settings on your machine) and seeing if that makes any difference.
Okay, I figured it out. You guys were correct. We were not generating the translated resx files correctly from Lingobit. Some of the files would get translated while others had the English text still in the resx.
Thanks for your help!
EDIT: Just to expand upon this, we specifically were messing up the al.exe command which takes the binary .resources file and creates a satellite assembly adding it to the executable's manifest. In the /embed command, you have to bind the resources file to a namespace. Our top-level name spaces were mapped correctly, but we weren't binding to sub-level namespaces on all of the resource files.

Categories

Resources