views:

23

answers:

1

Hi I have to add support for other languages in my application. Almost entire application is ready however I have a problem with translating a tooltip which is 'loaded' from resourcesDictioanry file. For couple element in my application I have the same tooltip. So instead of writting the same code over and over again I decied to put a tooltip into ResourceDitionary. My tooltip looks like that

        <TextBlock  FontWeight="Bold" Text="Text to translation" TextAlignment="Left" />
        <TextBlock Text="{Binding Path=_Code}" Grid.Column="1" TextWrapping="Wrap"/>
        <TextBlock FontWeight="Bold" Text="Text to translation" TextAlignment="Left" Grid.Row="1" />
        <TextBlock Text="{Binding Path=_Name}" Grid.Column="1" Grid.Row="1" TextWrapping="Wrap"/>
        <TextBlock Text="Text to translation:" Grid.Row="3" FontWeight="Bold" TextAlignment="Left" />

   </Grid>
</ToolTip>

What is the best way to implement multilanguage support from ResourcesDictionary ?

A: 

You should perhaps substitute

Text="Text to translation"

by

Text="{DynamicResource TOOLTIP_TEXT_ID}"

This recipy assumes your application's translation is resource dictionary-based, of course.

Vlad
But how the application will know which dictionary use ? I assume that I have to have two dictioaries. One which contains my default langage texts and second for other language.
pieere
Look at this document: http://msdn.microsoft.com/en-us/library/ms788718.aspx. You should put the localizable resources for each of the supported languages into separate so-called satellite assemblies. The correct assembly will be loaded automatically for you.
Vlad