~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/doc/pofile.txt

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-06 13:40:37 UTC
  • mfrom: (14097.2.8 bug-401618)
  • Revision ID: launchpad@pqm.canonical.com-20111006134037-76k7yw4rtcd91f9q
[r=abentley][bug=401618] Finally remove all use of POTMsgSet.sequence
        in our code, to fix an odd bug or two,
        and allow for column removal from the database.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
We need a helper method to better display test results.
75
75
 
76
 
    >>> def print_potmsgsets(potmsgsets, pofile=None):
 
76
    >>> def print_potmsgsets(potmsgsets, pofile):
77
77
    ...     for potmsgset in potmsgsets:
78
78
    ...         singular = plural = None
79
79
    ...         translation = ""
86
86
    ...             if len(plural) > 20:
87
87
    ...                plural = plural[:17] + "..."
88
88
    ...         if pofile is not None:
89
 
    ...             translation = potmsgset.getCurrentTranslation(
 
89
    ...             message = potmsgset.getCurrentTranslation(
90
90
    ...                 pofile.potemplate, pofile.language,
91
 
    ...                 pofile.potemplate.translation_side).translations[0]
 
91
    ...                 pofile.potemplate.translation_side)
 
92
    ...             if message is not None:
 
93
    ...                translation = message.translations[0]
92
94
    ...             if len(translation) > 20:
93
95
    ...                 translation = translation[:17] + "..."
94
96
    ...         print "%2d. %-20s   %-20s   %-20s" % (
95
 
    ...             potmsgset.sequence, singular, plural, translation)
 
97
    ...             potmsgset.getSequence(pofile.potemplate),
 
98
    ...             singular, plural, translation)
96
99
 
97
100
 
98
101
getFullLanguageCode
131
134
    >>> found_potmsgsets.count()
132
135
    4
133
136
 
134
 
    >>> print_potmsgsets(found_potmsgsets)
 
137
    >>> print_potmsgsets(found_potmsgsets, dummy_pofile)
135
138
     7. contact's header:      None
136
139
    14. The location and ...   None
137
140
    15. %d contact             %d contacts
144
147
    >>> found_potmsgsets.count()
145
148
    4
146
149
 
147
 
    >>> print_potmsgsets(found_potmsgsets)
 
150
    >>> print_potmsgsets(found_potmsgsets, dummy_pofile)
148
151
     7. contact's header:      None
149
152
    14. The location and ...   None
150
153
    15. %d contact             %d contacts
157
160
    >>> found_potmsgsets.count()
158
161
    2
159
162
 
160
 
    >>> print_potmsgsets(found_potmsgsets)
 
163
    >>> print_potmsgsets(found_potmsgsets, dummy_pofile)
161
164
    15. %d contact             %d contacts
162
165
    16. Opening %d contac...   Opening %d contac...
163
166