mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
common: Add filename parameter to GetLanguageByContent function
Internal code needs the filename to select a matcher, so not passing any filename means no language will ever be found otherwise.
This commit is contained in:
parent
bac0ef279c
commit
0990c2868d
@ -85,8 +85,8 @@ func GetLanguageByExtension(filename string) (language string, safe bool) {
|
||||
|
||||
// GetLanguageByContent returns detected language. If there are more than one possibles languages
|
||||
// it returns the first language by alphabetically order and safe to false.
|
||||
func GetLanguageByContent(content []byte) (language string, safe bool) {
|
||||
return getLanguageByStrategy(GetLanguagesByContent, "", content, nil)
|
||||
func GetLanguageByContent(filename string, content []byte) (language string, safe bool) {
|
||||
return getLanguageByStrategy(GetLanguagesByContent, filename, content, nil)
|
||||
}
|
||||
|
||||
// GetLanguageByClassifier returns the most probably language detected for the given content. It uses
|
||||
|
Loading…
Reference in New Issue
Block a user