Change language to Norwegian Bokmal error

I am trying to change language to "Norwegian Bokmal" or "Persian" in user/edit_current but I get this error:
2021-04-23 10:47:46,078 DEBUG middleware.log :: PUT /api/user/1 400 3.6 ms (0 DB calls) {:errors {:locale "value may be nil, or if non-nil, String must be a valid two-letter ISO language or language-country code e.g. en or en_US."}}
No other languages has this problem
Using Mysql: Ver 8.0.22-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
This is the request that has been sent:


This is the hash of commit I compiled 64e70c91a7295fe96117f034500547c74763f6e0 , This is in master branch
I tried to debug it but nothig worked out yet

Hi @Alpha
Post which commands you're using for building Metabase.
Have you build the translations? ./bin/i18n/build-translation-resources

I did ./bin/i18n/build-translation-resources and then I did lein run
Btw it has problem only with norwegian and persian
if building translations was the issue, no other langs should have work right?

@Alpha Something else must be wrong, but it's hard to tell. Does it only happen with lein run or also in a built JAR? I would guess it's something in your setup.

Also I tried with 200MB jar file that I downloaded from https://metabase.com/start/jar.html
It has same error too

I was debugging the code, so far i figured out that the problem was created by this code block in src/metabase/util/i18n/impl.clj


so I hardcoded it to true, then my language changed to persian successfully!
But the problem is some of translations aren't displayed correctly, seems like a unicode problem
Now website looks like this:

I emphasize again, like what you see in the picture only some translations don't display correctly

After lot's of digging, I ended up here:


seems like java didn't return "fa" as a available locale

I see, The problem was from my environment, I was using Oracle JDK v8
After I migrated to AdoptJdk 11, it fixed.
But still that unicode problem stays:

@Alpha
That looks like a font problem in your browser/OS.
Post "Diagnostic Info" from Admin > Troubleshooting.
And post the output of the these:

# OS and version
 sed -nE 's/^PRETTY_NAME="([^"]+)"$/\1/p' /etc/os-release
# Git branch and commit
 echo `git status | head -1 && git log -1 --format="commit %H"`
# Java version and architecture
 java -version
# Java variable configuration
 echo $JAVA_HOME
# Java path configuration
 echo $PATH | grep --color=never -oe "/usr/lib/jvm/[^:]*"
# Lein version
 lein --version
# NodeJS version
 node --version
# Yarn version
 yarn --version
# Clojure version
 clojure --help | grep Version
{
      "browser-info": {
        "language": "en-US",
        "platform": "Linux x86_64",
        "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36",
        "vendor": "Google Inc."
      },
      "system-info": {
        "file.encoding": "UTF-8",
        "java.runtime.name": "OpenJDK Runtime Environment",
        "java.runtime.version": "11.0.10+9",
        "java.vendor": "AdoptOpenJDK",
        "java.vendor.url": "https://adoptopenjdk.net/",
        "java.version": "11.0.10",
        "java.vm.name": "OpenJDK 64-Bit Server VM",
        "java.vm.version": "11.0.10+9",
        "os.name": "Linux",
        "os.version": "5.4.0-52-generic",
        "user.language": "en",
        "user.timezone": "Asia/Tehran"
      },
      "metabase-info": {
        "databases": [
          "h2",
          "mysql"
        ],
        "hosting-env": "unknown",
        "application-database": "mysql",
        "application-database-details": {
          "database": {
            "name": "MySQL",
            "version": "8.0.22-0ubuntu0.20.04.2"
          },
          "jdbc-driver": {
            "name": "MariaDB Connector/J",
            "version": "2.6.2"
          }
        },
        "run-mode": "dev",
        "version": {
          "date": "2021-04-13",
          "tag": "v0.39.1-SNAPSHOT",
          "branch": "?",
          "hash": "ce93921"
        },
        "settings": {
          "report-timezone": null
        }
      }
    }

And the commands output:

OS and version

Ubuntu 20.04.1 LTS

Git branch and commit

HEAD detached at upstream/master commit 64e70c91a7295fe96117f034500547c74763f6e0

Java version and architecture

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

Java variable configuration

/usr/lib/jvm/jdk1.8.0_241/

Java path configuration

/usr/lib/jvm/jdk1.8.0_241/bin
/usr/lib/jvm/jdk1.8.0_241/jre/bin
/usr/lib/jvm/jdk1.8.0_241//lib

While adoptjdk is right after jdk1.8.0_241 folder in:
/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64

Lein version

Leiningen 2.9.6 on Java 11.0.10 OpenJDK 64-Bit Server VM

NodeJS version

v12.21.0

Yarn version

1.22.5

Clojure version

Version: 1.10.1.727

Also I get this log after running lein run:

Warning: environ value /usr/lib/jvm/jdk1.8.0_241/ for key :java-home has been overwritten with /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64

@Alpha I don't know what is wrong, but it's something in your environment.

1 Like