Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix Hant css flag

Cette révision appartient à :
akuma06 2017-07-13 13:33:37 +02:00
Parent 78951680a6
révision bd71ca6d41
5 fichiers modifiés avec 13 ajouts et 8 suppressions

Voir le fichier

@ -142,7 +142,7 @@ func templateFunctions(vars jet.VarMap) jet.VarMap {
vars.Set("Sukebei", config.IsSukebei)
vars.Set("getDefaultLanguage", publicSettings.GetDefaultLanguage)
vars.Set("FlagCode", func(languageCode string) string {
return publicSettings.Flag(languageCode)
return publicSettings.Flag(languageCode, true)
})
vars.Set("getAvatar", func(hash string, size int) string {
return "https://www.gravatar.com/avatar/" + hash + "?s=" + strconv.Itoa(size)

Voir le fichier

@ -42,7 +42,7 @@
background-position: -48px 0;
}
.flag.flag-zh-Hant {
.flag.flag-Hant {
background-position: -48px -33px;
}

Voir le fichier

@ -1,3 +1,3 @@
/*!
* Generated with CSS Flag Sprite generator (https://www.flag-sprites.com/)
*/.flag{display:inline-block;width:16px;height:11px;background:url(flags.png) no-repeat}.flag.flag-zh{background-position:-16px 0}.flag.flag-sv{background-position:-16px -33px}.flag.flag-th{background-position:-32px -33px}.flag.flag-mx{background-position:0 -22px}.flag.flag-pt{background-position:-48px -22px}.flag.flag-ro{background-position:-64px -22px}.flag.flag-nb{background-position:-32px -22px}.flag.flag-es{background-position:-48px 0}.flag.flag-zh-Hant{background-position:-48px -33px}.flag.flag-ru{background-position:0 -33px}.flag.flag-ko{background-position:-64px -11px}.flag.flag-br{background-position:0 0}.flag.flag-it{background-position:-32px -11px}.flag.flag-nl{background-position:-16px -22px}.flag.flag-fr{background-position:-64px 0}.flag.flag-de{background-position:-32px 0}.flag.flag-ja{background-position:-48px -11px}.flag.flag-hu{background-position:0 -11px}.flag.flag-en{background-position:-64px -33px}.flag.flag-is{background-position:-16px -11px}.flag.flag-ca{background:url(flag_catalan.png) no-repeat}
*/.flag{display:inline-block;width:16px;height:11px;background:url(flags.png) no-repeat}.flag.flag-zh{background-position:-16px 0}.flag.flag-sv{background-position:-16px -33px}.flag.flag-th{background-position:-32px -33px}.flag.flag-mx{background-position:0 -22px}.flag.flag-pt{background-position:-48px -22px}.flag.flag-ro{background-position:-64px -22px}.flag.flag-nb{background-position:-32px -22px}.flag.flag-es{background-position:-48px 0}.flag.flag-Hant{background-position:-48px -33px}.flag.flag-ru{background-position:0 -33px}.flag.flag-ko{background-position:-64px -11px}.flag.flag-br{background-position:0 0}.flag.flag-it{background-position:-32px -11px}.flag.flag-nl{background-position:-16px -22px}.flag.flag-fr{background-position:-64px 0}.flag.flag-de{background-position:-32px 0}.flag.flag-ja{background-position:-48px -11px}.flag.flag-hu{background-position:0 -11px}.flag.flag-en{background-position:-64px -33px}.flag.flag-is{background-position:-16px -11px}.flag.flag-ca{background:url(flag_catalan.png) no-repeat}

Voir le fichier

@ -244,16 +244,21 @@ func Translate(languageCode string, to string) string {
// Flag reads the language's country code and return the country's flag if national true or the international flag for the language
func (lang *Language) Flag(national bool) string {
if national {
return Flag(lang.Tag)
return Flag(lang.Tag, false)
}
return lang.Code
}
// Flag reads the language's country code and return the country's flag if national true or the international flag for the language
func Flag(languageCode string) string {
languageSplit := strings.Split(languageCode, "-")
func Flag(languageCode string, parent bool) string {
lang := glang.Make(languageCode)
if parent {
lang = GetParentTag(languageCode)
}
languageSplit := strings.Split(lang.String(), "-")
if len(languageSplit) > 1 {
return languageSplit[1]
}
return languageCode
return lang.String()
}

Voir le fichier

@ -37,7 +37,7 @@ func TestCSSFlags(t *testing.T) {
contents := string(file)
for _, language := range languages {
flag := language.Flag(false)
flag := publicSettings.Flag(language.Code, true)
fmt.Printf("Finding css class for: %s (%s)\n", flag, language.Name)
if !strings.Contains(contents, ".flag-"+flag) {
t.Errorf("flags.css does not contains class .flag-%s. You probably need to update it.", flag)