Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Translation of external texts

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
uw



Joined: 20 Nov 2017
Posts: 2
Location: Germany

PostPosted: Mon Nov 20, 2017 3:12 pm    Post subject: Translation of external texts Reply with quote

Right now I´m evaluating Globalizer if it fits our needs for translation.
We are running a WPF application and have to show texts from an external control (plc).
Is it possible to translate texts we are getting from a control using resx files ?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Nov 20, 2017 9:34 pm    Post subject: Reply with quote

Do you mean the text is coming from a Programmable Logic Controller (PLC)?

Do you have any control over the text that it produces? If so the easiest solution is to have it send a short resource key instead of the actual text - then you use that to look up the text to display.

If the PLC is sending (for example) English text and you can't change that then one possible solution is to use the String.Hash function to create a unique key for each piece of text and then use the Hash as a resource key to lookup other languages. This will only work if the text is static - if it changes because, for instance, the PLC inserts times or names into the text then this won't work. In this case you would have to try a more sophisticated approach, for example using Regular Expressions to extract the static text, then translating that and reinserting the dynamic text.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
uw



Joined: 20 Nov 2017
Posts: 2
Location: Germany

PostPosted: Tue Nov 21, 2017 7:58 am    Post subject: Reply with quote

Infralution wrote:
Do you mean the text is coming from a Programmable Logic Controller (PLC)?

Do you have any control over the text that it produces? If so the easiest solution is to have it send a short resource key instead of the actual text - then you use that to look up the text to display.

If the PLC is sending (for example) English text and you can't change that then one possible solution is to use the String.Hash function to create a unique key for each piece of text and then use the Hash as a resource key to lookup other languages. This will only work if the text is static - if it changes because, for instance, the PLC inserts times or names into the text then this won't work. In this case you would have to try a more sophisticated approach, for example using Regular Expressions to extract the static text, then translating that and reinserting the dynamic text.


Yes we are talking about a "Programmable Logic Controller". We receive an invariant text and have to translate it. The PLC is not able to send us a resource key. How can we handle such an scenario with Globalizer ? We are able to put all PLC texts in a resource or XML file. How do we get the translated text if we only have the invariant text from the PLC ?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Nov 21, 2017 9:55 am    Post subject: Reply with quote

Does the invariant text ever change (or parts of it change)?

If it is always the same then you can take a list of all the possible text and then for each use the String.Hash() function to create a unique key for each possible text eg

Code:
string invariantText = "This is some text";
string resourceKey = invariantText.Hash().ToString();


You can then create a resources file with the resourceKey and Invariant Text which you will be able to translate using Globalizer.

When you receive a message from the PLC you can then retrieve the localized resource by doing something like:

Code:
string invariantText = PLC.GetText();
string resourceKey = invariantText .Hash().ToString();
string localizedText = Properties.Resources.ResourceManager.GetString(resourceKey);


If your text changes or has things that vary in it (like dates, times etc) then it is a bit more complicated.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group