Fix for *.ts conflict between TypeScript and Qt Translation files

This commit is contained in:
ruben2020
2014-01-04 21:32:16 +08:00
parent 1f38db61df
commit 40b2e19310
4 changed files with 39904 additions and 39468 deletions

View File

@@ -19,6 +19,9 @@ module Linguist
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
disambiguate_pl(data, languages)
end
if languages.all? { |l| ["TypeScript", "XML"].include?(l) }
disambiguate_ts(data, languages)
end
end
end
@@ -40,6 +43,16 @@ module Linguist
matches
end
def self.disambiguate_ts(data, languages)
matches = []
if (data.include?("</translation>"))
matches << Language["XML"]
else
matches << Language["TypeScript"]
end
matches
end
def self.active?
!!ACTIVE
end

View File

@@ -1791,6 +1791,7 @@ XML:
- .tmSnippet
- .tmTheme
- .tml
- .ts
- .ui
- .urdf
- .vxml

File diff suppressed because it is too large Load Diff

47
samples/XML/pt_BR.ts Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="pt_BR">
<context>
<name>MainWindow</name>
<message>
<location filename="../forms/mainwindow.ui" line="22"/>
<source>United Kingdom</source>
<translation>Reino Unido</translation>
</message>
<message>
<location filename="../forms/mainwindow.ui" line="38"/>
<source>God save the Queen</source>
<translation>Deus salve a Rainha</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="46"/>
<source>England</source>
<translation>Inglaterra</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="47"/>
<source>Wales</source>
<translation>Gales</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="48"/>
<source>Scotland</source>
<translation>Escócia</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="49"/>
<source>Northern Ireland</source>
<translation>Irlanda Norte</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="51"/>
<source>Portuguese</source>
<translation>Português</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="52"/>
<source>English</source>
<translation>Inglês</translation>
</message>
</context>
</TS>