← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n] Rev 400: Add F_ and P_ to format messages

 

------------------------------------------------------------
revno: 400
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: linuxdcpp-i18n
timestamp: Tue 2010-11-09 21:45:41 -0600
message:
  Add F_ and P_ to format messages
modified:
  SConstruct
  linux/IntlUtil.hh
  linux/WulforUtil.cc
  linux/bookentry.cc
  linux/downloadqueue.cc


--
lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n

Your team LinuxDC++ Team is subscribed to branch lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-11-03 05:24:00 +0000
+++ SConstruct	2010-11-10 03:45:41 +0000
@@ -149,8 +149,8 @@
 pot_args = ['xgettext', '--default-domain=$PACKAGE', '--package-name=$PACKAGE',
 		'--msgid-bugs-address=https://translations.launchpad.net/linuxdcpp',
 		'--copyright-holder=LinuxDC++ Team', '--add-comments=TRANSLATORS',
-		'--keyword=_', '--keyword=N_', '--keyword=C_', '--from-code=UTF-8',
-		'--foreign-user', '--no-wrap', '--boost', '--sort-output',
+		'--keyword=_', '--keyword=N_', '--keyword=C_', '--keyword=F_', '--keyword=P_',
+		'--from-code=UTF-8', '--foreign-user', '--no-wrap', '--boost', '--sort-output',
 		'--language=$LANGUAGE', '--output=$TARGET', '$SOURCES']
 pot_build = Builder(action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES'))
 env.Append(BUILDERS = {'PotBuild' : pot_build})

=== modified file 'linux/IntlUtil.hh'
--- linux/IntlUtil.hh	2010-11-03 05:24:00 +0000
+++ linux/IntlUtil.hh	2010-11-10 03:45:41 +0000
@@ -26,14 +26,20 @@
 #include <string>
 #include <glib/gi18n.h>
 
-static inline std::string message_format(const std::string &text) {
-	boost::format fmt;
+static inline boost::format message_format(const char *text)
+{
+	boost::format fmt(text);
 	fmt.exceptions(boost::io::no_error_bits);
-	fmt.parse(text);
-	return fmt.str();
-}
-
-#define F_(x) message_format(gettext(x))
+	return fmt;
+}
+
+static inline boost::format message_format(const std::string &text)
+{
+	return message_format(text.c_str());
+}
+
+#define F_(text, params) (message_format(_(text)) params).str()
+#define P_(text, text_plural, params, n) (message_format(g_dngettext(NULL, text, text_plural, n)) params).str()
 
 #endif /* LINUXDCPP_INTL_UTIL_HH */
 

=== modified file 'linux/WulforUtil.cc'
--- linux/WulforUtil.cc	2010-05-22 14:23:56 +0000
+++ linux/WulforUtil.cc	2010-11-10 03:45:41 +0000
@@ -38,7 +38,7 @@
 using namespace std;
 using namespace dcpp;
 
-const string WulforUtil::ENCODING_LOCALE = _("System default");
+const string WulforUtil::ENCODING_LOCALE = C_("Character encoding", "System default");
 std::vector<std::string> WulforUtil::charsets;
 const std::string WulforUtil::magnetSignature = "magnet:?xt=urn:tree:tiger:";
 GtkIconFactory* WulforUtil::iconFactory = NULL;
@@ -154,7 +154,7 @@
 {
 	StringList hubs = ClientManager::getInstance()->getHubNames(cid);
 	if (hubs.empty())
-		return _("Offline");
+		return C_("User", "Offline");
 	else
 		return Util::toString(hubs);
 }
@@ -190,22 +190,22 @@
 	if (charsets.size() == 0)
 	{
 		charsets.push_back(ENCODING_LOCALE);
-		charsets.push_back(_("UTF-8 (Unicode)"));
-		charsets.push_back(_("CP1252 (Western Europe)"));
-		charsets.push_back(_("CP1250 (Central Europe)"));
-		charsets.push_back(_("ISO-8859-2 (Central Europe)"));
-		charsets.push_back(_("ISO-8859-7 (Greek)"));
-		charsets.push_back(_("ISO-8859-8 (Hebrew)"));
-		charsets.push_back(_("ISO-8859-9 (Turkish)"));
-		charsets.push_back(_("ISO-2022-JP (Japanese)"));
-		charsets.push_back(_("SJIS (Japanese)"));
-		charsets.push_back(_("CP949 (Korean)"));
-		charsets.push_back(_("KOI8-R (Cyrillic)"));
-		charsets.push_back(_("CP1251 (Cyrillic)"));
-		charsets.push_back(_("CP1256 (Arabic)"));
-		charsets.push_back(_("CP1257 (Baltic)"));
-		charsets.push_back(_("GB18030 (Chinese)"));
-		charsets.push_back(_("TIS-620 (Thai)"));
+		charsets.push_back(C_("Character encoding", "UTF-8 (Unicode)"));
+		charsets.push_back(C_("Character encoding", "CP1252 (Western Europe)"));
+		charsets.push_back(C_("Character encoding", "CP1250 (Central Europe)"));
+		charsets.push_back(C_("Character encoding", "ISO-8859-2 (Central Europe)"));
+		charsets.push_back(C_("Character encoding", "ISO-8859-7 (Greek)"));
+		charsets.push_back(C_("Character encoding", "ISO-8859-8 (Hebrew)"));
+		charsets.push_back(C_("Character encoding", "ISO-8859-9 (Turkish)"));
+		charsets.push_back(C_("Character encoding", "ISO-2022-JP (Japanese)"));
+		charsets.push_back(C_("Character encoding", "SJIS (Japanese)"));
+		charsets.push_back(C_("Character encoding", "CP949 (Korean)"));
+		charsets.push_back(C_("Character encoding", "KOI8-R (Cyrillic)"));
+		charsets.push_back(C_("Character encoding", "CP1251 (Cyrillic)"));
+		charsets.push_back(C_("Character encoding", "CP1256 (Arabic)"));
+		charsets.push_back(C_("Character encoding", "CP1257 (Baltic)"));
+		charsets.push_back(C_("Character encoding", "GB18030 (Chinese)"));
+		charsets.push_back(C_("Character encoding", "TIS-620 (Thai)"));
 	}
 	return charsets;
 }
@@ -248,9 +248,9 @@
 
 bool WulforUtil::splitMagnet(const string &magnet, string &name, int64_t &size, string &tth)
 {
-	name = _("Unknown");
+	name = C_("Magnet", "Unknown");
 	size = 0;
-	tth = _("Unknown");
+	tth = C_("Magnet", "Unknown");
 
 	if (!isMagnet(magnet.c_str()) || magnet.size() <= magnetSignature.length())
 		return FALSE;

=== modified file 'linux/bookentry.cc'
--- linux/bookentry.cc	2010-10-11 06:05:22 +0000
+++ linux/bookentry.cc	2010-11-10 03:45:41 +0000
@@ -101,6 +101,7 @@
 	if (len > labelSize)
 	{
 		gchar truncatedText[text.size()];
+		// TRANSLATORS: Tab label ellipsis to indicate text is longer than tab width
 		const string clipText = _("...");
 		len = labelSize - g_utf8_strlen(clipText.c_str(), -1);
 		g_utf8_strncpy(truncatedText, text.c_str(), len);

=== modified file 'linux/downloadqueue.cc'
--- linux/downloadqueue.cc	2010-10-22 04:05:48 +0000
+++ linux/downloadqueue.cc	2010-11-10 03:45:41 +0000
@@ -225,10 +225,10 @@
 
 void DownloadQueue::updateStatus_gui()
 {
-	setStatus_gui(_("Items: ") + Util::toString(currentItems), "statusItems");
-	setStatus_gui(_("Size: ") + Util::formatBytes(currentSize), "statusFileSize");
-	setStatus_gui(_("Files: ") + Util::toString(totalItems), "statusFiles");
-	setStatus_gui(_("Size: ") + Util::formatBytes(totalSize), "statusTotalSize");
+	setStatus_gui(F_("Items: %1%", % currentItems), "statusItems");
+	setStatus_gui(F_("Size: %1%", % Util::formatBytes(currentSize)), "statusFileSize");
+	setStatus_gui(F_("Files: %1%", % totalItems), "statusFiles");
+	setStatus_gui(F_("Size: %1%", % Util::formatBytes(totalSize)), "statusTotalSize");
 }
 
 void DownloadQueue::addFiles_gui(vector<StringMap> files, bool firstUpdate)
@@ -1237,6 +1237,7 @@
 	string nick;
 	map<string, string> source;
 	int online = 0;
+	int totalSources = item->getSources().size();
 
 	params["Filename"] = item->getTargetFileName();
 	params["Path"] = Util::getFilePath(item->getTarget());
@@ -1261,7 +1262,7 @@
 
 	// Status
 	if (item->isWaiting())
-		params["Status"] = Util::toString(online) + _(" of ") + Util::toString(item->getSources().size()) + _(" user(s) online");
+		params["Status"] = P_("%1% of %2% user online", "%1% of %2% users online", % online % totalSources, totalSources);
 	else 
 		params["Status"] = _("Running...");
 	
@@ -1269,8 +1270,8 @@
 	params["Size Sort"] = Util::toString(item->getSize());
 	if (item->getSize() < 0)
 	{
-		params["Size"] = _("Unknown");
-		params["Exact Size"] = _("Unknown");
+		params["Size"] = C_("Size", "Unknown");
+		params["Exact Size"] = C_("Size", "Unknown");
 	}
 	else
 	{
@@ -1291,6 +1292,8 @@
 	}
 
 	// Priority
+	/* TRANSLATORS: Please make sure that the priorities
+	   are consistent with the ones in the glade files. */
 	switch (item->getPriority())
 	{
 		case QueueItem::PAUSED: