mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
update language lexer translations
This commit is contained in:
parent
784ad38c38
commit
9255fd2c34
@ -27,6 +27,15 @@ log = logging.getLogger(__name__)
|
|||||||
EXTENSIONS = {
|
EXTENSIONS = {
|
||||||
'md': 'Markdown',
|
'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):
|
def guess_language(file_name):
|
||||||
@ -41,7 +50,7 @@ def guess_language(file_name):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if lexer:
|
if lexer:
|
||||||
return str(lexer.name)
|
return translate_language(str(lexer.name))
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -55,6 +64,12 @@ def guess_language_from_extension(extension):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def translate_language(language):
|
||||||
|
if language in TRANSLATIONS:
|
||||||
|
language = TRANSLATIONS[language]
|
||||||
|
return language
|
||||||
|
|
||||||
|
|
||||||
def number_lines_in_file(file_name):
|
def number_lines_in_file(file_name):
|
||||||
lines = 0
|
lines = 0
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user