fix(GODT-3133): Fix GetSystemLanguage

This commit is contained in:
Leander Beernaert
2023-11-28 09:32:40 +01:00
parent 7d13c99710
commit 50dd046b82
5 changed files with 45 additions and 75 deletions

View File

@ -15,18 +15,18 @@
// You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
//go:build !windows
// +build !windows
package sentry
import "os"
import (
"github.com/jeandeaual/go-locale"
"github.com/sirupsen/logrus"
)
func GetSystemLang() string {
lang := os.Getenv("LC_ALL")
if lang == "" {
lang = os.Getenv("LANG")
lang, err := locale.GetLanguage()
if err != nil {
logrus.WithError(err).Error("Failed to get system language")
lang = "Unknown"
}
return lang
}