From 9255fd2c34a403b14b423628f47b7a7419c0d526 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Sat, 26 Oct 2013 17:59:41 -0700 Subject: [PATCH] update language lexer translations --- packages/wakatime/wakatime/stats.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/wakatime/wakatime/stats.py b/packages/wakatime/wakatime/stats.py index 9aaed1e..c7a9973 100644 --- a/packages/wakatime/wakatime/stats.py +++ b/packages/wakatime/wakatime/stats.py @@ -27,6 +27,15 @@ log = logging.getLogger(__name__) EXTENSIONS = { 'md': 'Markdown', } +TRANSLATIONS = { + 'CSS+Genshi Text': 'CSS', + 'CSS+Lasso': 'CSS', + 'HTML+Django/Jinja': 'HTML', + 'HTML+Lasso': 'HTML', + 'JavaScript+Genshi Text': 'JavaScript', + 'JavaScript+Lasso': 'JavaScript', + 'Perl6': 'Perl', +} def guess_language(file_name): @@ -41,7 +50,7 @@ def guess_language(file_name): except: pass if lexer: - return str(lexer.name) + return translate_language(str(lexer.name)) else: return None @@ -55,6 +64,12 @@ def guess_language_from_extension(extension): return None +def translate_language(language): + if language in TRANSLATIONS: + language = TRANSLATIONS[language] + return language + + def number_lines_in_file(file_name): lines = 0 try: