15 Star 71 Fork 21

Gitee 极速下载/Fyne

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/fyne-io/fyne
克隆/下载
locale.go 549 Bytes
一键复制 编辑 原始数据 按行查看 历史
Andy Williams 提交于 2024-02-27 05:35 +08:00 . Add missed translation and documentation
package fyne
import "strings"
// Locale represents a user's locale (language, region and script)
//
// Since: 2.5
type Locale string
// LanguageString returns a version of the local without the script portion.
// For example "en" or "fr-FR".
func (l Locale) LanguageString() string {
count := strings.Count(string(l), "-")
if count < 2 {
return string(l)
}
pos := strings.LastIndex(string(l), "-")
return string(l)[:pos]
}
// String returns the complete locale as a standard string.
func (l Locale) String() string {
return string(l)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mirrors/Fyne.git
git@gitee.com:mirrors/Fyne.git
mirrors
Fyne
Fyne
master

搜索帮助