Hi all, This is about the simpler of the two escalated translations bugs.
Bug 734765 is about adding some information about translations sharing between templates to the +templates page (that one is registered on different "series" views, such as DistroSeries and ProductSeries, so that might need to be taken into consideration). Basically, the goal is to show concise information from pages like https://translations.launchpad.net/ubuntu/natty/+source/gnome-session/+sharing-details on the full listing https://translations.launchpad.net/ubuntu/natty/+templates The view base itself (BaseSeriesTemplateView in lib/lp/translations/browser/potemplate.py) is basically a thin (or not so thin) wrapper around POTemplateSubset. That is optimized to execute one query to fetch all the templates, and the view does no batching because one big list is much more useful for Ubuntu Translation coordinators (and other than Ubuntu, nothing has more than say 150 templates, with 1 or 2 being most common). Now, we get to the more interesting bits, which is sharing. I'll explain the entire concept in low level terms, even though most of it doesn't apply to this particular bug. Sharing is a way to ensure that when translations happen in one translation template (POTemplate), they automagically appear in another. How those two templates relate is critical to proper sharing. Translation sharing happens along two axes: inside a single product/source package, and between a product (series) and source package (in distro series). We can say that two POTemplates take part in sharing if: 1. they have the same name (potemplate1.name == potemplate2.name) 2. one of the following holds: a. they are in the same product series (potemplate1.productseries == potemplate2.productseries) b. they are in the same source package (potemplate1.sourcepackagename == potemplate2.sourcepackagename AND potemplate1.distroseries.distribution == potemplate2.distroseries.distribution) c. potemplate1.productseries is linked to potemplate2.sourcepackage OR potemplate1.sourcepackage is linked to potemplate2.productseries through the Packaging table The bug is about showing links to potemplate2 for 2c. How "sharing" templates are calculated can be seen in getSharingSubset in POTemplateSet. Do note that since templates from different series in a single product or sourcepackage already participate in sharing, that means that they also participate in sharing with those templates linked through packaging table (eg. product/1.0/template shares with ubuntu/hardy/product-2.0/template), so 2c is not entirely correct, but I believe it's sufficient for this bug. I am asking for clarification. However, it was a long-standing plan to do away with POTemplateSet which kind of becomes meaningless/ugly in this particular circumstance (and many others it is used in). It would be so much nicer to switch the view to use TranslationTemplatesCollection instead, and just add a restriction similar to above using the logic like in joinOuterPOFile. Of course, it'd be good to keep all the sharing conditions localised, so sharing code between getSharingSubset and this new code would be very nice. Those're just my personal preference, and whoever picks it up can do whatever they want. :) Note that one of the important optimizations for +templates page was not using fmt:url and instead constructing URLs by hand. We might need to be smart about that for the linked template as well (traversal canonical_url is doing was too slow, taking roughly 30ms per link, and considering there are over 1000 x 5 links to render, we were hitting timeouts just in Python time). Note that the links will include parts of other context as well (eg. for ubuntu:+templates, a relevant linked productseries which is different for each template), so we might need to prefetch that too. Sorry if I went into too much detail, thus ruining the exploratory path for someone, but I just tried to explain the core concepts and some gotchas with the page as is (and I did restrain myself from going deeper into it, because I know I have very strong opinions about all the translations code :). If there is still some unclear things, I'd be happy to chat about it. Cheers, Danilo -- Mailing list: https://launchpad.net/~yellow Post to : [email protected] Unsubscribe : https://launchpad.net/~yellow More help : https://help.launchpad.net/ListHelp

