Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance i18n readability #23

Merged
merged 4 commits into from
Jul 12, 2024
Merged

Conversation

xrz-cloud
Copy link
Contributor

差不多可以把develop分支合并主线了吧,编译产物已经测试过了。

顺带action现在wangyoucao577/go-release-action@v1上游已经支持构建mips/mipsle-softfloat了,希望改一下action可以支持路由器上跑。

@peanut996
Copy link
Owner

差不多可以把develop分支合并主线了吧,编译产物已经测试过了。

顺带action现在wangyoucao577/go-release-action@v1上游已经支持构建mips/mipsle-softfloat了,希望改一下action可以支持路由器上跑。

但是路由器的指令集不是有很多种不一样的吗?只添加这一种应该覆盖不完全吧

@peanut996 peanut996 merged commit 61195fa into peanut996:develop Jul 12, 2024
@xrz-cloud
Copy link
Contributor Author

主流的路由器就mips(le)+softfloatmips64(le),剩下的arm已经支持了

@peanut996
Copy link
Owner

对了 是不是只有在terminal 的 LANG是zh-CN的时候才能触发。 你试过windows环境的这个变量吗 假如是中文windows

@xrz-cloud
Copy link
Contributor Author

windows之前没实现,现在才找到相关方法:
参见 https://stackoverflow.com/questions/51829386/golang-get-system-language

这个应该可以:

func main() {
  locale, err := GetLocale()
  fmt.Printf("OK: locale=%q, err=%v\n", locale, err)
  // OK: locale="en-US", err=nil
}

func GetLocale() (string, error) {
  // Check the LANG environment variable, common on UNIX.
  // XXX: we can easily override as a nice feature/bug.
  envlang, ok := os.LookupEnv("LANG")
  if ok {
    return strings.Split(envlang, ".")[0], nil
  }

  // Exec powershell Get-Culture on Windows.
  cmd := exec.Command("powershell", "Get-Culture | select -exp Name")
  output, err := cmd.Output()
  if err == nil {
    return strings.Trim(string(output), "\r\n"), nil
  }

  return "", fmt.Errorf("cannot determine locale")
}

@peanut996
Copy link
Owner

我在develop改了一点代码,但是感觉多语言国际化这个需求不是很重要。 毕竟现在IPv4 都用不了了,外国人也不用,中国人看不懂更好吧。。

安全一点,release 路由器的倒是可以早日安排上。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants