[Aptitude-svn-commit] r3582 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Sun Jul 3 17:25:53 UTC 2005
Author: dburrows
Date: Sun Jul 3 17:25:50 2005
New Revision: 3582
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/README.i18n
branches/aptitude-0.3/aptitude/src/aptitude.h
Log:
Add support for and document described translations.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sun Jul 3 17:25:50 2005
@@ -1,5 +1,10 @@
2005-07-03 Daniel Burrows <dburrows@debian.org>
+ * src/aptitude.h, README.i18n:
+
+ Add a routine 'P_()' which strips off everything up to the first
+ pipe symbol in the string.
+
* src/vscreen/transcode.cc:
When coding errors are encountered, replace the offending
Modified: branches/aptitude-0.3/aptitude/README.i18n
==============================================================================
--- branches/aptitude-0.3/aptitude/README.i18n (original)
+++ branches/aptitude-0.3/aptitude/README.i18n Sun Jul 3 17:25:50 2005
@@ -41,3 +41,16 @@
string "yes_key" is used to set the default binding for buttons
labelled "Yes". To bind "j" to this command, you could translate
"yes_key" to "ja_key", "ja", or even just "j".
+
+ * Described translations
+
+ Some translations have descriptions or disambiguating text to the
+ left of the input and output string. In these cases, everything
+ up to and including the first pipe character will be removed
+ before the string is used. If no pipe character is present in the
+ string, the string will be used without modifications.
+
+ For instance, the string "help.txt encoding|UTF-8" can be
+ translated to either "help.txt encoding|ISO-8859-1",
+ "|ISO-8859-1", or "ISO-8859-1", and will have the same effect in
+ each case.
Modified: branches/aptitude-0.3/aptitude/src/aptitude.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/aptitude.h (original)
+++ branches/aptitude-0.3/aptitude/src/aptitude.h Sun Jul 3 17:25:50 2005
@@ -23,6 +23,21 @@
# include <libintl.h>
# define _(Text) gettext (Text)
# define N_(Text) Text
+
+/** Strips everything up to and includeing the first pipe character
+ * from the string. Strings without a pipe character are unchanged.
+ */
+inline const char *P_(const char *Text)
+{
+ const char * const translation = gettext(Text);
+ const char * const stripto = strchr(translation, '|');
+
+ if(stripto == NULL)
+ return Text;
+ else
+ return stripto+1;
+}
+
#else
# undef bindtextdomain
# define bindtextdomain(Domain, Directory) /* empty */
@@ -30,10 +45,12 @@
# define textdomain(Domain) /* empty */
# define _(Text) Text
# define N_(Text) Text
+# define P_(Text) Text
# define gettext(Text) Text
# define dgettext(Domain, Text) Text
#endif
+
// This is used to store the location of the binary as determined by
// argv[0].
extern const char *argv0;
More information about the Aptitude-svn-commit
mailing list