mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			624 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			624 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
						|
 | 
						|
package lang
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						|
	"net/http"
 | 
						|
)
 | 
						|
 | 
						|
type SwitchAction struct {
 | 
						|
	actionutils.ParentAction
 | 
						|
}
 | 
						|
 | 
						|
func (this *SwitchAction) Init() {
 | 
						|
	this.Nav("", "", "")
 | 
						|
}
 | 
						|
 | 
						|
func (this *SwitchAction) RunPost(params struct{}) {
 | 
						|
	var langCode = this.LangCode()
 | 
						|
	if len(langCode) == 0 || langCode == "zh-cn" {
 | 
						|
		langCode = "en-us"
 | 
						|
	} else {
 | 
						|
		langCode = "zh-cn"
 | 
						|
	}
 | 
						|
 | 
						|
	this.AddCookie(&http.Cookie{
 | 
						|
		Name:  "edgelang",
 | 
						|
		Value: langCode,
 | 
						|
		Path:  "/",
 | 
						|
	})
 | 
						|
 | 
						|
	this.Success()
 | 
						|
}
 |