func (lang *LangSelector) Destroy() { if lang.lhelper == nil { return } localehelper.DestroyLocaleHelper(lang.lhelper) lang.lhelper = nil }
func doSetLocale(locale string) error { lhelper, err := localehelper.NewLocaleHelper( "com.deepin.api.LocaleHelper", "/com/deepin/api/LocaleHelper", ) if err != nil { return err } defer localehelper.DestroyLocaleHelper(lhelper) err = lhelper.GenerateLocale(locale) if err != nil { return err } var content = fmt.Sprintf("LANG=%s\nLANGUAGE=%s", locale, strings.Split(locale, ".")[0]) return ioutil.WriteFile(defaultLocaleFile, []byte(content), 0644) }