From 64c50cca000036bee4b9a7d8add5cdcd5a565ce5 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 15 Apr 2013 21:42:56 +0200 Subject: [PATCH] Localized g++ theme Use gettext to get the GCC localized messages --- colout/colout_g++.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/colout/colout_g++.py b/colout/colout_g++.py index 0b2f079..51bb1d8 100644 --- a/colout/colout_g++.py +++ b/colout/colout_g++.py @@ -1,9 +1,21 @@ def theme(): + import gettext + import os + + # get g++ version + gv = os.popen("g++ -dumpversion").read().strip() + + # get the current translations of gcc + t = gettext.translation("gcc-"+gv) + _ = t.ugettext + # _("msg") will return the given message, translated + + return [ - [ "error", "red", "bold" ], - [ "warning", "magenta", "bold" ], - [ "note", "blue", "bold" ], + [ _("error: "), "red", "bold" ], + [ _("warning: "), "magenta", "bold" ], + [ _("note: "), "blue", "bold" ], # [-Wflag] [ "\[-W.*\]", "magenta"], # Filename:line number