From c2e4bc6936fd4e089605f57736e8a965c117b4d6 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Mon, 22 Aug 2005 21:27:24 +0000 Subject: [PATCH] Make default menus and action tooltips localizable. SVN revision: 16289 --- config/strings.c | 158 ++++++++++++++++++++++++++++++++++++++++------ config/strings.pl | 77 ++++++++++++++++++++++ 2 files changed, 215 insertions(+), 20 deletions(-) create mode 100644 config/strings.pl diff --git a/config/strings.c b/config/strings.c index bbb57d60..29a647da 100644 --- a/config/strings.c +++ b/config/strings.c @@ -1,25 +1,66 @@ #define _(x) x -char *s[] = { -/* The settings menu */ -_("Focus Settings ..."), -_("Move & Resize Settings ..."), -_("Pager Settings ..."), -_("Window Placement Settings ..."), -_("Multiple Desktop Settings ..."), -_("Virtual Desktop Settings ..."), -_("Autoraise Settings ..."), -_("Tooltip Settings ..."), -_("Audio Settings ..."), -_("Group Settings ..."), -_("Remember Settings ..."), -_("Misc. FX Settings ..."), -_("Special FX Settings ..."), -_("Desktop Background Settings ..."), -_("Theme Transparency Settings ..."), -_("Composite Settings ..."), -_("Miscellaneous Settings ..."), - +const char *txt[] = { +/* actionclasses.cfg */ +_("Click and drag to move desktop\n(on any desktop but desktop 0)"), +_("Switch Desktops"), +_("Go to the next desktop."), +_("Switch Desktops"), +_("Go to the previous desktop."), +_("Move"), +_("Move this window."), +_("Shade/Unshade this window."), +_("Show the Window Options menu."), +_("Toggle the shaded (rolled-up) state of this window."), +_("Show/Hide group borders."), +_("Start a group."), +_("Add to current group."), +_("Break this window's group."), +_("Shade."), +_("Unshade."), +_("Resize"), +_("Resize this window."), +_("Move this window."), +_("Resize Horizontally"), +_("Resize this window horizontally."), +_("Move this window."), +_("Resize Vertically"), +_("Resize this window vertically."), +_("Move this window."), +_("Close"), +_("Close this window."), +_("Forcibly destroy this window."), +_("Maximize Height"), +_("Toggle between maximum screen height and normal height."), +_("Maximize Width"), +_("Toggle between maximum screen width and normal width."), +_("Maximize"), +_("Toggle between maximum screen size and normal size."), +_("Toggle between maximum screen width and normal width."), +_("Toggle between maximum screen height and normal height."), +_("Send To Another Desktop"), +_("Send this Window to the next desktop."), +_("Send To Another Desktop"), +_("Send this Window to the previous desktop."), +_("Snapshot"), +_("This button does nothing interesting."), +_("Shade"), +_("Shade (roll up) this window."), +_("Unshade"), +_("Unshade (unroll) this window."), +_("Window Options"), +_("Open the Window Options Menu."), +_("Iconify"), +_("Iconify (Minimize) this window."), +_("Open the Window Options Menu."), +_("More Buttons"), +_("Show more buttons."), +_("Raise"), +_("Raise this window to the top."), +_("Lower"), +_("Lower this window."), +_("Stick/Unstick"), +_("Toggle the Omnipresent (visible on all Desktops) state of this window."), /* bindings.cfg */ _("Clicking your mouse on the desktop will perform\nthe following actions"), _("Display User Menus"), @@ -32,4 +73,81 @@ _("Display Group Menu"), _("Display Settings Menu"), _("Go Back a Desktop"), _("Go Forward a Desktop"), +/* menus.cfg */ +_("Cleanup Desktop"), +_("Goto Next Desktop"), +_("Goto Previous Desktop"), +_("Create New Iconbox"), +_("Create Systray"), +_("Purge config file cache"), +_("Purge pager background cache"), +_("Purge background selector cache"), +_("Purge all caches"), +_("Query config file cache usage"), +_("Query pager background cache usage"), +_("Query background selector cache usage"), +_("Query all cache usage"), +_("Regenerate Menus"), +_("Focus Settings ..."), +_("Move & Resize Settings ..."), +_("Pager Settings ..."), +_("Window Placement Settings ..."), +_("Multiple Desktop Settings ..."), +_("Virtual Desktop Settings ..."), +_("Autoraise Settings ..."), +_("Tooltip Settings ..."), +_("Audio Settings ..."), +_("Group Settings ..."), +_("Remember Settings ..."), +_("Special FX Settings ..."), +_("Misc. FX Settings ..."), +_("Desktop Background Settings ..."), +_("Theme Transparency Settings ..."), +_("Composite Settings ..."), +_("Miscellaneous Settings ..."), +_("Help"), +_("About Enlightenment"), +_("About this theme"), +_("Restart Enlightenment"), +_("Log Out"), +_("Max Height Toggle"), +_("Available Max Height Toggle"), +_("Absolute Max Height Toggle"), +_("Max Width Toggle"), +_("Available Max Width Toggle"), +_("Absolute Max Width Toggle"), +_("Max Size Toggle"), +_("Available Max Size Toggle"), +_("Absolute Max Size Toggle"), +_("Fullscreen/Normal"), +_("Zoom/Unzoom"), +_("Below"), +_("Normal"), +_("Above"), +_("On Top"), +_("20%"), +_("40%"), +_("60%"), +_("80%"), +_("100%"), +_("Toggle Shadows"), +_("Toggle Skip Window Lists"), +_("Toggle Fixed Position"), +_("Toggle Never Focus"), +_("Toggle Click to Focus"), +_("Configure this window's group(s)"), +_("Start a new group"), +_("Select group to add this window to"), +_("Add this window to the current group"), +_("Remove this window from a group"), +_("Destroy a group this window belongs to"), +_("Show/Hide this window's group(s)"), +_("Close"), +_("Annihilate"), +_("Iconify"), +_("Raise"), +_("Lower"), +_("Shade/Unshade"), +_("Stick/Unstick"), +_("Remember..."), }; diff --git a/config/strings.pl b/config/strings.pl new file mode 100644 index 00000000..7ec1d80e --- /dev/null +++ b/config/strings.pl @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +# Script to extract localizable strings from config files +# $ perl strings.pl actionclasses.cfg bindings.cfg menus.cfg >strings.c + +sub x() { + + # actionclasses.cfg + $TTT = 0; + $TAT = 0; + + if (/__TOOLTIP_TEXT\s+\"(.*)\"/) { + # print "_(\"$1\"),\n" + if ($ttt) { + $ttt = "$ttt\\n$1"; + } else { + $ttt = "$1"; + } + $TTT = 1; + } elsif (/__TOOLTIP_ACTION_TEXT\s+\"(.*)\"/) { + # print "_(\"$1\"),\n"; + $tat = "$1"; + $TAT = 1; + } + + if (!($TTT) && $ttt) { + print "_(\"$ttt\"),\n"; + $ttt = ""; + } + + if (!($TAT) && $tat) { + print "_(\"$tat\"),\n"; + $tat = ""; + } + + # bindings.cfg + $TDT = 0; + + if (/^Tooltip\s+(.*)$/) { + # print "_(\"$1\"),\n" + if ($tdt) { + $tdt = "$tdt\\n$1"; + } else { + $tdt = "$1"; + } + $TDT = 1; + } + + if (!($TDT) && $tdt) { + print "_(\"$tdt\"),\n"; + $tdt = ""; + } + + # menus.cfg + if (/ADD_MENU_TEXT_ITEM\s*\(\s*(\".*\"),/) { + $t = "$1"; + print "_($t),\n"; + } +} + +# +# Start +# +print "#define _(x) x\n\n"; +print "const char *txt[] = {\n"; + +for ($i=0; $i <= $#ARGV; $i++) { + $f = $ARGV[$i]; + print "/* $f */\n"; + open F, $f; + for () { + x(); + } + close $f; +} + +print "};\n";