Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 24 Jun 2008 09:10:24 -0700 (PDT),    group: microsoft.public.dotnet.internationalization        back       


Visual Studio - Set text of a label, pointing to a resource   
Hi there,

 I'm building a windows application, and I want to enable localization
(I've got several user controls, forms, etc).

 I'm building a resource file containing all the text and images that
can be localized.

 Now, I want to set the set the text value of the labels to a string
inside the resource file in design mode.

 Using code is simple:

labelX.Text = Properties.Resources.strName;

 and the labels text will have the same value as the string defined as
"strName".

 What I want to do, is be able to do this in design mode using Visual
Studio 2005, is this possible? Is there any sort of notation that
allows me to just set a Text property to use the resource?

 Like {Properties.Resources.strName} or $Properties.Resources.strName

Thanks ahead for all the help,

L. Pinho
date: Tue, 24 Jun 2008 09:10:24 -0700 (PDT)   author:   lpinho

Re: Visual Studio - Set text of a label, pointing to a resource   
Have you tried using the built-in localization support provided by
the WinForms Designer? If you set a form's 'Localizable' property
to 'True', the Designer will automatically serialize all localizable
elements to the form's RESX file.

Your code-level resource work could then be limited to runtime
error messages and the like (which can be stored in the default
project-level RESX file).

Cheers,
Garrett McGowan [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"lpinho"  wrote in message 
news:9b90e71b-d9b9-4735-9fa0-cd4d213e8d7d@8g2000hse.googlegroups.com...
> Hi there,
>
> I'm building a windows application, and I want to enable localization
> (I've got several user controls, forms, etc).
>
> I'm building a resource file containing all the text and images that
> can be localized.
>
> Now, I want to set the set the text value of the labels to a string
> inside the resource file in design mode.
>
> Using code is simple:
>
> labelX.Text = Properties.Resources.strName;
>
> and the labels text will have the same value as the string defined as
> "strName".
>
> What I want to do, is be able to do this in design mode using Visual
> Studio 2005, is this possible? Is there any sort of notation that
> allows me to just set a Text property to use the resource?
>
> Like {Properties.Resources.strName} or $Properties.Resources.strName
>
> Thanks ahead for all the help,
>
> L. Pinho
date: Tue, 24 Jun 2008 12:34:54 -0700   author:   Garrett McGowan \(MSFT\)

Re: Visual Studio - Set text of a label, pointing to a resource   
Hi Garrett,

 somehow I missed that in UserControls, thanks.

On 24 Jun, 20:34, "Garrett McGowan \(MSFT\)"
 wrote:
> Have you tried using the built-in localization support provided by
> the WinForms Designer? If you set a form's 'Localizable' property
> to 'True', the Designer will automatically serialize all localizable
> elements to the form's RESX file.
>
> Your code-level resource work could then be limited to runtime
> error messages and the like (which can be stored in the default
> project-level RESX file).
>
> Cheers,
> Garrett McGowan [MSFT]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified athttp://www.microsoft.com/info/cpyright.htm
>
> "lpinho"  wrote in message
>
> news:9b90e71b-d9b9-4735-9fa0-cd4d213e8d7d@8g2000hse.googlegroups.com...
>
> > Hi there,
>
> > I'm building a windows application, and I want to enable localization
> > (I've got several user controls, forms, etc).
>
> > I'm building a resource file containing all the text and images that
> > can be localized.
>
> > Now, I want to set the set the text value of the labels to a string
> > inside the resource file in design mode.
>
> > Using code is simple:
>
> > labelX.Text = Properties.Resources.strName;
>
> > and the labels text will have the same value as the string defined as
> > "strName".
>
> > What I want to do, is be able to do this in design mode using Visual
> > Studio 2005, is this possible? Is there any sort of notation that
> > allows me to just set a Text property to use the resource?
>
> > Like {Properties.Resources.strName} or $Properties.Resources.strName
>
> > Thanks ahead for all the help,
>
> > L. Pinho
date: Thu, 26 Jun 2008 01:31:25 -0700 (PDT)   author:   lpinho

Re: Visual Studio - Set text of a label, pointing to a resource   
Hi all,

the Visualk Studio built-in localization has some limitation. It is
suitable for small projects only. Becasue:

1. It is difficult for the traslator to go throuh all forms and do not
miss anything. It's better to have averything only in a few resx
files.
2. Sometimes you have some text repeated more times, like "New item",
"Delete item". It's better to have only one resource for one of them.
3. More languages you add, the slower is the compile time, if you have
many forms. (Search Google, some people have published real results
for this.)

So I would like to have exactly what "lpinho" said: a possibility to
write to designer something like {Properties.Resources.strName} or
$Properties.Resources.strName. Do you know about some plugin to VS
2005 which can do that? Or can you give me a hint how can I make it by
myself? Maybe how to hijack text box from Properties window?

It would be also usefult in a situation like setting a maximum for
NumericUpDown from a constant.

Thank you
Ondrej Medek

On 26 Èen, 10:31, lpinho  wrote:
> Hi Garrett,
>
>  somehow I missed that in UserControls, thanks.
>
> On 24 Jun, 20:34, "Garrett McGowan \(MSFT\)"
>
>  wrote:
> > Have you tried using the built-in localization support provided by
> > the WinForms Designer? If you set a form's 'Localizable' property
> > to 'True', the Designer will automatically serialize all localizable
> > elements to the form's RESX file.
>
> > Your code-level resource work could then be limited to runtime
> > error messages and the like (which can be stored in the default
> > project-level RESX file).
>
> > Cheers,
> > Garrett McGowan [MSFT]
>
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > Use of included script samples are subject to the terms specified athttp://www.microsoft.com/info/cpyright.htm
>
> > "lpinho"  wrote in message
>
> >news:9b90e71b-d9b9-4735-9fa0-cd4d213e8d7d@8g2000hse.googlegroups.com...
>
> > > Hi there,
>
> > > I'm building a windows application, and I want to enable localization
> > > (I've got several user controls, forms, etc).
>
> > > I'm building a resource file containing all the text and images that
> > > can be localized.
>
> > > Now, I want to set the set the text value of the labels to a string
> > > inside the resource file in design mode.
>
> > > Using code is simple:
>
> > > labelX.Text = Properties.Resources.strName;
>
> > > and the labels text will have the same value as the string defined as
> > > "strName".
>
> > > What I want to do, is be able to do this in design mode using Visual
> > > Studio 2005, is this possible? Is there any sort of notation that
> > > allows me to just set a Text property to use the resource?
>
> > > Like {Properties.Resources.strName} or $Properties.Resources.strName
>
> > > Thanks ahead for all the help,
>
> > > L. Pinho
date: Wed, 30 Jul 2008 00:10:03 -0700 (PDT)   author:   Ondrej Medek

Re: Visual Studio - Set text of a label, pointing to a resource   
On Jul 30, 5:10 pm, Ondrej Medek  wrote:
> Hi all,
>
> the Visualk Studio built-in localization has some limitation. It is
> suitable for small projects only. Becasue:
>
> 1. It is difficult for the traslator to go throuh all forms and do not
> miss anything. It's better to have averything only in a few resx
> files.
> 2. Sometimes you have some text repeated more times, like "New item",
> "Delete item". It's better to have only one resource for one of them.
> 3. More languages you add, the slower is the compile time, if you have
> many forms. (Search Google, some people have published real results
> for this.)

The are a number of good localization tools that will overcome the
limitations you mention above.  Infralution sells a product,
Globalizer.NET (www.infralution.com/globalizer.html), that can
automatically scan your projects for localizable forms and resources
and compile all the resources into a single workspace that allows a
translator to work on one convenient file with automatic translation
of duplicate strings.  Once the translator has completed their work
you can either generate localized resx files (so that you can build
them using Visual Studio and the normal process) or generate the
binary satellite assemblies directly.    Unlike most other tools
Globalizer.NET also allows the translator to preview and even run the
translated application without having to use Visual Studio or have the
source code.

The single resource file approach has a number of disadvantages:

1.  Translations often depend on the context.  Just because the same
word is used in English in two different forms doesn't mean the same
word should be used in another Language.   You can overcome this by
defining a separate resource entry in these cases, however you don't
know upfront (before localizing in every possible language) when this
may occur.   So the only way to avoid code changes during the
localization phase is to define a separate resource for each form -
which brings you back to the standard .NET localization solution.

2.  Strings are not the only things that need localization.  The
standard .NET localization approach allows you to change the size and
layout of forms as required for specific languages.   This means that
you can allow extra room as required for languages like German which
can be verbose without leaving large ugly spaces in other languages.
In addition right to left languages like Hebrew will require a
completely different layout.   You can do all this in the Visual
Studio forms editor and check your layout at design time.

Regards
Grant Frisken
Infralution
www.infralution.com
date: Wed, 30 Jul 2008 23:39:34 -0700 (PDT)   author:   Grant

Re: Visual Studio - Set text of a label, pointing to a resource   
> 2. Sometimes you have some text repeated more times, like "New item",
> "Delete item". It's better to have only one resource for one of them.

With the others you are right, but this one is risky.

The same English word is transalated in different ways depending on context.
For instance "Print" is translated onto French as "Imprimer" or "Impression",
depending if it is a commanding element (ie button) vs describing stuff 
(label, title).

Same element type can also require different translations.
Examples: "Scan" can mean "scan a page of paper" or "scan the disk" and
have different translations.
"New" can be translated as "Nuovo" "Nuova" "Nuovi" "Nuove"
(masculin singular, feminin singular, masculin plural, feminin plural)

Uless you don't speak all target languages, you have no way to judge if
two elements require a different translation or not.
So you better leave that "saving" alone.


-- 
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
date: Thu, 31 Jul 2008 00:02:25 -0700   author:   Mihai N.

Re: Visual Studio - Set text of a label, pointing to a resource   
On 31 Èec, 08:39, Grant  wrote:
> On Jul 30, 5:10 pm, Ondrej Medek  wrote:
>
> > Hi all,
>
> > the Visualk Studio built-in localization has some limitation. It is
> > suitable for small projects only. Becasue:
>
> > 1. It is difficult for the traslator to go throuh all forms and do not
> > miss anything. It's better to have averything only in a few resx
> 1.  Translations often depend on the context.  Just because the same
> word is used in English in two different forms doesn't mean the same
> word should be used in another Language.   You can overcome this by
> defining a separate resource entry in these cases, however you don't
> know upfront (before localizing in every possible language) when this
> may occur.   So the only way to avoid code changes during the
> localization phase is to define a separate resource for each form -
> which brings you back to the standard .NET localization solution.
>
> 2.  Strings are not the only things that need localization.  The
> standard .NET localization approach allows you to change the size and
> layout of forms as required for specific languages.   This means that
> you can allow extra room as required for languages like German which
> can be verbose without leaving large ugly spaces in other languages.
> In addition right to left languages like Hebrew will require a
> completely different layout.   You can do all this in the Visual
> Studio forms editor and check your layout at design time.

Yes, I know about difficulties with translations, I am not a native
english speaker. My proposed solution is flexible enough. It does not
prevent from using VS 2005 the old way. I think it might be also
simple to implement.
date: Thu, 31 Jul 2008 04:06:50 -0700 (PDT)   author:   Ondrej Medek

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us