StrataFrame Forum

Creation of Localization Keys?

http://forum.strataframe.net/Topic18509.aspx

By Edhy Rijo - 8/15/2008

Hi,

I am starting to localize a project (English/Spanish) and noticed that the SF labels have a Task facility to automatically create a Localization Key in the Default Language project, but for other controls like the Form's Text, GradientFormHeader Title, ThemedGroupBox, ListView Column Text, does not have this kind of facility, or at least I have not found an easy way to auto-create those localization keys.

So my question is how to handle those controls other than Labels to auto create the localization keys? specially for ListView columns headers.

Thanks!

By Juan Carlos Pazos - 8/15/2008

Hi Edjy



I use this code, for a ListView and for the BrowseLayout Window, for other controls for exmple DevExpress use the same approach.



Public Sub New()



' This call is required by the Windows Form Designer.

InitializeComponent()



'-- Idiomas es para un control ListView

Me.lvConexiones.Columns.Item(1).Text = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("lvConexionesFecha")

Me.lvConexiones.Columns.Item(2).Text = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("lvConexionesA")

Me.lvConexiones.Columns.Item(3).Text = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("lvConexionesPor")

Me.lvConexiones.Columns.Item(4).Text = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("lvConexionesObjetivo")

Me.lvConexiones.Columns.Item(5).Text = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("lvConexionesMetodo")

'Idiomas ventana de búsqueda

BrowseDialogFamilias.SearchFields.Item(0).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutIdFamilia")

BrowseDialogFamilias.BrowseResultsLayout.BrowseColumns.Item(0).ColumnHeaderText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutIdFamilia")

BrowseDialogFamilias.SearchFields.Item(1).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutApellidos")

BrowseDialogFamilias.BrowseResultsLayout.BrowseColumns.Item(1).ColumnHeaderText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutApellidos")

BrowseDialogFamilias.SearchFields.Item(2).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("EstatusMiembro")

BrowseDialogFamilias.BrowseResultsLayout.BrowseColumns.Item(2).ColumnHeaderText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("EstatusMiembro")

BrowseDialogFamilias.SearchFields.Item(3).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutTipoDonador")

BrowseDialogFamilias.BrowseResultsLayout.BrowseColumns.Item(3).ColumnHeaderText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutTipoDonador")

BrowseDialogFamilias.SearchFields.Item(4).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutDomicilio1")

BrowseDialogFamilias.BrowseResultsLayout.BrowseColumns.Item(4).ColumnHeaderText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutTelefono1")

BrowseDialogFamilias.SearchFields.Item(5).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutDomicilio2")

BrowseDialogFamilias.SearchFields.Item(6).FieldLabelText = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("layoutZona")



End Sub



Hope you can find usefull
By Edhy Rijo - 8/15/2008

Thanks Juan Carlos.

It is a bit messy this way, if this has to be done for each BrowserDialog and each ListView, then it does not make sense.

Trent, Ivan, can you confirm if this is the only way to deal with localization for these controls?

By Trent L. Taylor - 8/18/2008

Actually, this is only partially correct.

The form, ThemedGroupBox, GradientFormHeader, etc. all have localization properties.

  1. Form - LocalizationKey and PropertyToLocalize
  2. GradientFormHeader - TitleLocalizationKey, DetailTextLocalizationKey
  3. ThemedGroupBox - same as form

If you will show the property sheet in category mode instead of alphabetic, you will see that there is an SF category called, "StrataFrame: Localization" with the related properties.

However, a ListView column and BD labels will have to be done manually with the retrieve text method like Juan explained.

By Edhy Rijo - 8/18/2008

Hi Trent,

Trent L. Taylor (08/18/2008)
However, a ListView column and BD labels will have to be done manually with the retrieve text method like Juan explained.

But why these controls ListView Columns and BD Labels does not have a LocalizationKey property? 

It is important to me to understand how a feature works so I can get the most benefit out of it.

Also, is there an event that will be fired when using Localization.ShowAvailableLanguages() so the currently opened forms would be shown with the selected language? 

By Juan Carlos Pazos - 8/18/2008

Edjy



Take a look to the Localization sample, they do what you asking for:



'-- Force this page to "re-load" to update the controls on this page. Generally you DO NOT

' need to make this call. This was just added so that you would not have to get out and come

' back in to see the changes.

Me.OnLoad(EventArgs.Empty)




Regards
By Trent L. Taylor - 8/18/2008

Juan is on top if it today! Smile
By Edhy Rijo - 8/18/2008

Thanks Juan, Trent.

Still I would like to know about this:

But why these controls ListView Columns and BD Labels does not have a LocalizationKey property? 

It is important to me to understand how a feature works so I can get the most benefit out of it.

By Trent L. Taylor - 8/18/2008

Because these are enumerated values.  The Search fields on the BD, maybe at some point.  But eh columns on teh ListView are standard .NET ListViewColumns...not SFListViewColumns.  So for this to work on a ListView we would have to create our own columns types...so at this point we may as well not inherit from the ListView at all and write our own...which a localization key is DEFINITELY not worth that kind of energy.  Maybe the next version of the ListView.
By Edhy Rijo - 8/18/2008

Thanks for the explanation, I think I understand now why not all .NET controls are SF subclassed.  I am sure this would be a good enhancement for those using the localization engine in future versions.