Hi Nick,
The main thing to understand about multistring is that the list is for
cases where we're dealing with plural forms; only formats like MO, PO,
XLIFF doing PO, and .TS support those. So if the format supports
plurals then it should be using the list part of multistring. Otherwise
normal strings don't use the list part and I think simple assignment to
the multistring object should be fine.
Caveat: Dwayne says that without looking at any code. But that might
help you understand. Also look at any test_*.py and
misc/test_multistring.py. Hope that helps.
On 2011-03-28 11:42, Nick Ruiz wrote:
> Hello,
>
> I'm writing some back-end code to automate translations. I would like to
> populate a Unit object with a target multistring. I would like to learn
> more about the multistring object in relation to translations;
> unfortunately, the API doesn't provide me with enough information about
> the behavior of multistrings.
>
> How should I create a multistring to store a translation? Should I
> construct it with the following:
>
> s = "hello world"
> ms = multistring(s)
>
> What about multiple translations? Is this correct?
> ss = ["hello world", "hi world", "hello earth"]
> ms = multistring(ss)
>
> How do I access each of the translations? If I use ms.strings, I get the
> following:
>
> [multistring([u'hello world',u'hi world',u'hello earth']), u'hi world',
> u'hello earth']
>
> I see that I can get the alternative translations by referencing
> ms.strings[1] and ms.strings[2], but how should I access the first
> string (e.g. "hello world")? If I use unicode(ms), I can get "hello
> world", but is this the best approach?
>
> If I want to add another translation, should I use ms.strings.append("hi
> earth")?
>
> What are your recommendations for best practices for working with
> multistring? I want to make sure that my code follows the use of your
> patterns correctly.
>
> Thanks for your help,
> Nick
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Translate-pootle mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/translate-pootle
--
regards
Dwayne
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle