mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Fix for *.ts conflict between TypeScript and Qt Translation files
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
									
								
							
							
						
						
									
										47
									
								
								samples/XML/pt_BR.ts
									
									
									
									
									
										Normal 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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user