Emdebian localisation support
langupdate - installing localisation support
langupdate is a frontend for the Emdebian implementation of translation packages (tdebs) to handle the selection and installation of TDebs to match supported locales and the current set of installed packages.
Disc space is not cheapCurrent Debian packages collate all available translations into a single package which can easily lead to over 250Mb of unused translation files on a typical installation. i.e. the translations alone could take up four times the amount of space intended for the entire operating system. Emdebian generates a single package for every translation of each Emdebian package, leading to a 70% reduction in installation size but a tenfold increase in the number of binary packages built from each source package. To solve this scalability problem, langupdate supports a secondary sources list and secondary apt cache so that the main apt cache can be kept as small as possible.
In Debian 6.0 "Squeeze", Debian TDebs will be supported (actual TDebs will be in the subsequent release) but these will also contain all translations in a single file. The Debian TDeb will be organised to separate translation content for each locale root into dedicated sections within the TDeb file format. Emdebian Grip will use this functionality to separate those data components into separate TDebs. In due course, Debian is likely to deploy similar support on the client side to strip unwanted locale roots from downloaded TDebs. Emdebian Grip transfers that burden to the repository, to allow for smaller downloads to Grip devices.
langupdate queries the secondary apt cache to get a list of all translation packages (tdebs) that match the list of locales supported on the device. This list is then compared with the list of installed binaries. The translation packages that match the installed package are then installed with apt-get. langupdate will be adapted to work with both Emdebian Grip and Emdebian Crush.
Why C and C++?
The langupdate code is a mix of C and C++ because there is no direct hook into apt-get upgrade and no easy way of reading the apt-cache from C without forking a call to apt-cache itself. The apt bindings already require a fork to call apt-get. So langupdate uses libapt-pkg which is a C++ library. The rest of the code is C because it was the easiest way to do it at the time. If anyone fancies porting langupdate to just C++ for use on devices that do not have room for libglib2.0-0, patches are welcome.
langupdate uses a temporary file for the sources.list and updates it from the list of supported locales each time langupdate is run, i.e. it combines the effects of 'apt-get update' with 'apt-get upgrade'. tdeb packages have no dependencies so 'dist-upgrade' is not required.
Code documentation is available via doxygen.
langupdate is a native Emdebian package available via Debian. It is gripped for Emdebian Grip and cross-built for Emdebian Crush.
em_installtdeb is a new script in emdebian-tools based on debhelper, to create translation packages (tdebs) for Emdebian. em_installtdeb is intended to separate out the individual translation files from the current Debian packages into packages without any translation files and a series of tdeb locale packages, one per translation. Generated packages use the syntax: $package-locale-$language_code_$version_all.deb
Once a package uses em_installtdeb, translation files should be removed from all packages in the normal build. em_installtdeb runs as a second build (very small, very fast) that simply converts and packages the *.po files into tdebs. Tdeb packages have no dependencies and no packages may depend upon them.
Each package now built for Emdebian includes tdeb support so that if the package contains gettext-compliant translations, tdeb packages are created. Emdebian also supports a locale repository with search support. Currently, certain compromises are made to allow tdebs to work without changes to packages like dpkg or reprepro - including the need to make two uploads, one for the main package (without translations) and one for the generated tdeb .changes file and all of the tdeb packages. For more information on em_installtdeb, see the em_installtdeb manpage.
Other resources on tdebs
Back to the Emdebian Project homepage.