| 1 | /* sections_trans.cc - translate debian sections into friendlier names |
|---|
| 2 | * (c) 2004 Michael Vogt |
|---|
| 3 | * |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #include <libintl.h> |
|---|
| 7 | |
|---|
| 8 | #include "sections_trans.h" |
|---|
| 9 | |
|---|
| 10 | char *transtable[][2] = { |
|---|
| 11 | // TRANSLATORS: Alias for the Debian package section "admin" |
|---|
| 12 | {"admin", _("System Administration")}, |
|---|
| 13 | // TRANSLATORS: Alias for the Debian package section "base" |
|---|
| 14 | {"base", _("Base System")}, |
|---|
| 15 | // TRANSLATORS: Alias for the Debian package section "comm" |
|---|
| 16 | {"comm", _("Communication")}, |
|---|
| 17 | // TRANSLATORS: Alias for the Debian package section "devel" |
|---|
| 18 | {"devel", _("Development")}, |
|---|
| 19 | // TRANSLATORS: Alias for the Debian package section "doc" |
|---|
| 20 | {"doc", _("Documentation")}, |
|---|
| 21 | // TRANSLATORS: Alias for the Debian package section "editors" |
|---|
| 22 | {"editors", _("Editors")}, |
|---|
| 23 | // TRANSLATORS: Alias for the Debian package section "electronics" |
|---|
| 24 | {"electronics", _("Electronics")}, |
|---|
| 25 | // TRANSLATORS: Alias for the Debian package section "emmbedded" |
|---|
| 26 | {"embedded", _("Embedded Devices")}, |
|---|
| 27 | // TRANSLATORS: Alias for the Debian package section "games" |
|---|
| 28 | {"games", _("Games and Amusement")}, |
|---|
| 29 | // TRANSLATORS: Alias for the Debian package section "gnome" |
|---|
| 30 | {"gnome", _("GNOME Desktop Environment")}, |
|---|
| 31 | // TRANSLATORS: Alias for the Debian package section "graphics" |
|---|
| 32 | {"graphics", _("Graphics")}, |
|---|
| 33 | // TRANSLATORS: Alias for the Debian package section "hamradio" |
|---|
| 34 | {"hamradio", _("Amateur Radio")}, |
|---|
| 35 | // TRANSLATORS: Alias for the Debian package section "interpreters" |
|---|
| 36 | {"interpreters", _("Interpreted Computer Languages")}, |
|---|
| 37 | // TRANSLATORS: Alias for the Debian package section "KDE" |
|---|
| 38 | {"kde", _("KDE Desktop Environment")}, |
|---|
| 39 | // TRANSLATORS: Alias for the Debian package section "libdevel" |
|---|
| 40 | {"libdevel", _("Libraries - Development")}, |
|---|
| 41 | // TRANSLATORS: Alias for the Debian package section "libs" |
|---|
| 42 | {"libs", _("Libraries")}, |
|---|
| 43 | // TRANSLATORS: Alias for the Debian package section "mail" |
|---|
| 44 | {"mail", _("Email")}, |
|---|
| 45 | // TRANSLATORS: Alias for the Debian package section "math" |
|---|
| 46 | {"math", _("Mathematics")}, |
|---|
| 47 | // TRANSLATORS: Alias for the Debian package section "misc" |
|---|
| 48 | {"misc", _("Miscellaneous - Text Based")}, |
|---|
| 49 | // TRANSLATORS: Alias for the Debian package section "net" |
|---|
| 50 | {"net", _("Networking")}, |
|---|
| 51 | // TRANSLATORS: Alias for the Debian package section "news" |
|---|
| 52 | {"news", _("Newsgroup")}, |
|---|
| 53 | // TRANSLATORS: Alias for the Debian package section "oldlibs" |
|---|
| 54 | {"oldlibs", _("Libraries - Old")}, |
|---|
| 55 | // TRANSLATORS: Alias for the Debian package section "otherosfs" |
|---|
| 56 | {"otherosfs", _("Cross Platform")}, |
|---|
| 57 | // TRANSLATORS: Alias for the Debian package section "perl" |
|---|
| 58 | {"perl", _("Perl Programming Language")}, |
|---|
| 59 | // TRANSLATORS: Alias for the Debian package section "python" |
|---|
| 60 | {"python", _("Python Programming Language")}, |
|---|
| 61 | // TRANSLATORS: Alias for the Debian package section "science" |
|---|
| 62 | {"science", _("Science")}, |
|---|
| 63 | // TRANSLATORS: Alias for the Debian package section "shells" |
|---|
| 64 | {"shells", _("Shells")}, |
|---|
| 65 | // TRANSLATORS: Alias for the Debian package section "sound" |
|---|
| 66 | {"sound", _("Multimedia")}, |
|---|
| 67 | // TRANSLATORS: Alias for the Debian package section "tex" |
|---|
| 68 | {"tex", _("TeX Authoring")}, |
|---|
| 69 | // TRANSLATORS: Alias for the Debian package section "text" |
|---|
| 70 | {"text", _("Word Processing")}, |
|---|
| 71 | // TRANSLATORS: Alias for the Debian package section "utils" |
|---|
| 72 | {"utils", _("Utilities")}, |
|---|
| 73 | // TRANSLATORS: Alias for the Debian package section "web" |
|---|
| 74 | {"web", _("World Wide Web")}, |
|---|
| 75 | // TRANSLATORS: Alias for the Debian package section "x11" |
|---|
| 76 | {"x11", _("Miscellaneous - Graphical")}, |
|---|
| 77 | // TRANSLATORS: The section of the package is not known |
|---|
| 78 | {"unknown", _("Unknown")}, |
|---|
| 79 | // TRANSLATORS: Alias for the Debian package section "alien" |
|---|
| 80 | {"alien", _("Converted From RPM by Alien")}, |
|---|
| 81 | |
|---|
| 82 | // TRANSLATORS: Alias for the Debian package section "non-US" |
|---|
| 83 | // Export to the outside of the USA is not allowed |
|---|
| 84 | // or restricted |
|---|
| 85 | {"non-US", _("Restricted On Export")}, |
|---|
| 86 | // TRANSLATORS: Alias for the Debian package section "non free" |
|---|
| 87 | {"non-free", _("non free")}, |
|---|
| 88 | // TRANSLATORS: Alias for the Debian package section "contrib" |
|---|
| 89 | // Free software that depends on non-free software |
|---|
| 90 | {"contrib", _("contrib")}, |
|---|
| 91 | //{"non-free",_("<i>(non free)</i>")}, |
|---|
| 92 | //{"contrib",_("<i>(contrib)</i>")}, |
|---|
| 93 | {NULL, NULL} |
|---|
| 94 | }; |
|---|
| 95 | |
|---|
| 96 | #ifndef HAVE_RPM |
|---|
| 97 | string trans_section(string sec) |
|---|
| 98 | { |
|---|
| 99 | string str = sec; |
|---|
| 100 | string suffix; |
|---|
| 101 | // baaaa, special case for stupid debian package naming |
|---|
| 102 | if (str == "non-US/non-free") { |
|---|
| 103 | str = _("Restricted On Export"); |
|---|
| 104 | suffix = _("non free"); |
|---|
| 105 | } |
|---|
| 106 | if (str == "non-US/non-free") { |
|---|
| 107 | str = _("Restricted On Export"); |
|---|
| 108 | suffix = _("contrib"); |
|---|
| 109 | } |
|---|
| 110 | // if we have something like "contrib/web", make "contrib" the |
|---|
| 111 | // suffix and translate it independently |
|---|
| 112 | string::size_type n = str.find("/"); |
|---|
| 113 | if (n != string::npos) { |
|---|
| 114 | suffix = str.substr(0, n); |
|---|
| 115 | str.erase(0, n + 1); |
|---|
| 116 | for (int i = 0; transtable[i][0] != NULL; i++) { |
|---|
| 117 | if (suffix == transtable[i][0]) { |
|---|
| 118 | suffix = _(transtable[i][1]); |
|---|
| 119 | break; |
|---|
| 120 | } |
|---|
| 121 | } |
|---|
| 122 | } |
|---|
| 123 | for (int i = 0; transtable[i][0] != NULL; i++) { |
|---|
| 124 | if (str == transtable[i][0]) { |
|---|
| 125 | str = _(transtable[i][1]); |
|---|
| 126 | break; |
|---|
| 127 | } |
|---|
| 128 | } |
|---|
| 129 | // if we have a suffix, add it |
|---|
| 130 | if (!suffix.empty()) { |
|---|
| 131 | ostringstream out; |
|---|
| 132 | ioprintf(out, "%s (%s)", str.c_str(), suffix.c_str()); |
|---|
| 133 | str = out.str(); |
|---|
| 134 | } |
|---|
| 135 | return str; |
|---|
| 136 | } |
|---|
| 137 | #else |
|---|
| 138 | string trans_section(string sec) |
|---|
| 139 | { |
|---|
| 140 | return dgettext("synaptic", sec.c_str()); |
|---|
| 141 | } |
|---|
| 142 | #endif |
|---|