Skip to content
Snippets Groups Projects
Select Git revision
  • 05f47b0388b6a441cd3fdefaf0052cef7125dd96
  • master default protected
  • 1.31
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
  • 4.32.0
  • 4.31.0
  • 4.30.1
  • 4.30.0
  • 4.29.1
  • 4.29.0
  • 4.28.0
  • 4.27.0
  • 4.26.0
  • 4.25.5
  • 4.25.4
  • 4.25.3
  • 4.25.2
  • 4.25.1
23 results

tutorial-i18n-locale-and-formatter.html

Blame
  • messages.go 939 B
    // Copyright 2023 schukai GmbH
    // SPDX-License-Identifier: AGPL-3.0
    
    package environment
    
    import (
    	"github.com/gookit/color"
    	"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
    	"strings"
    )
    
    func PrintMessages() {
    
    	const indent = "  "
    
    	if len(State.errors) > 0 {
    		color.Error.Println(strings.ToUpper(translations.T.Sprintf("Error")) + ":")
    	}
    
    	for _, message := range State.errors {
    		color.Error.Println(indent + message)
    	}
    
    	if len(State.warnings) > 0 {
    		color.Warn.Println(strings.ToUpper(translations.T.Sprintf("Warn")) + ":")
    	}
    
    	for _, message := range State.warnings {
    		color.Warn.Println(indent + message)
    	}
    
    	if len(State.messages) > 0 {
    		color.Info.Println(strings.ToUpper(translations.T.Sprintf("Info")) + ":")
    	}
    
    	for _, message := range State.messages {
    		color.Info.Println(indent + message)
    	}
    
    	// reset
    	State.messages = []string{}
    	State.warnings = []string{}
    	State.errors = []string{}
    
    }