# Copyright (C) 2010 Daniel Burrows # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA. Import('all_aptitude_srcs', 'po_env') pofile_languages = [ 'ar', 'ast', 'bs', 'ca', 'cs', 'da', 'de', 'dz', 'el', 'es', 'eu', 'fi', 'fr', 'gl', 'hu', 'it', 'ja', 'km', 'ku', 'lt', 'mr', 'nb', 'ne', 'nl', 'nn', 'pl', 'pt', 'pt_BR', 'ro', 'ru', 'sk', 'sv', 'th', 'tl', 'tr', 'uk', 'vi', 'zh_CN', 'zh_TW', ] def BuildPoFile(env, lang, potfile = 'aptitude.pot'): '''Build the po file for the given language, compile it to a mo file, and install the compiled form. Also distribute *both* the po file and the mo file.''' po_file = env.Msgmerge(lang, potfile) # TODO: the Precious() call should be in the pofile builder, if # that's even possible? env.Precious(po_file) mo_file = env.Msgfmt(po_file) po_env.Dist(po_file, mo_file) env.Install('$LOCALEDIR/$LANG/LC_MESSAGES', LANG = lang) env.Alias('update-po', mo_file) return mo_file aptitude_pot = po_env.Xgettext('aptitude.pot', all_aptitude_srcs) po_env.Dist(aptitude_pot) # I seriously considered making aptitude.pot a default target, but # that would pollute the version control history with a bunch of # relatively meaningless changes. Better to only build it on request. po_env.Alias('update-po', aptitude_pot) # Rules relating to keeping the translations up-to-date. for lang in pofile_languages: BuildPoFile(po_env, lang, aptitude_pot)