I have some strings in different languages; for example:
- "kot jest dobry" (in Polish)
- "cat is good" (in English)
They are captions of buttons that are translated from English to the language chosen from the user.
Which is the best way to compare these captions, programmatically?
Since both the strings are translations of one another you can maintain a translation table and if you want to find out if two strings are same you can just look them up in your table and if they happen to fall in the same row, then they are equal for example
So populate a list of
TranslatedText
objects with each string and assign same id to same pieces of text. Later to compare you can lookup the corresponding object in list and check the Id like soAssuming the strings you want to compare are called
firstString
andsecondString
;