1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package language 6 7 // BaseLanguages returns the list of all supported base languages. It generates 8 // the list by traversing the internal structures. 9 func BaseLanguages() []Language { 10 base := make([]Language, 0, NumLanguages) 11 for i := 0; i < langNoIndexOffset; i++ { 12 // We included "und" already for the value 0. 13 if i != nonCanonicalUnd { 14 base = append(base, Language(i)) 15 } 16 } 17 i := langNoIndexOffset 18 for _, v := range langNoIndex { 19 for k := 0; k < 8; k++ { 20 if v&1 == 1 { 21 base = append(base, Language(i)) 22 } 23 v >>= 1 24 i++ 25 } 26 } 27 return base 28 } 29