Return non-zero output from BE i18n on error (#23373)
Want to return non-zero on unrecognized forms so that CI can indicate when forms are added that cannot be parsed. And example of a completely valid form of `trs` that we cannot identify with this code is ```clojure ;; from driver/util.clj (-> "Cycle detected resolving dependent visible-if properties for driver {0}: {1}" (trs driver cyclic-props) (ex-info {:type qp.error-type/driver :driver driver :cyclic-visible-ifs cyclic-props}) throw) ``` The string literal is threaded into the `trs` macro, so it validates correctly but we cannot identify the literal in tooling while making the pot file. Now output of bin/i18n/update-translation-template would be the following: ```shell ❯ ./update-translation-template [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.pprint.js as it exceeds the max of 500KB. [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs-runtime/cljs.core.js as it exceeds the max of 500KB. [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.core.js as it exceeds the max of 500KB. ~/projects/work/metabase/bin/i18n ~/projects/work/metabase Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/17.0.1-zulu/zulu-17.jdk/Contents/Home SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Created pot file at ../../locales/metabase-backend.pot Found 1396 forms for translations Grouped into 1313 distinct pot entries Found 1 forms that could not be analyzed {:file "metabase/driver/util.clj", :line 362, :original (trs driver cyclic-props), :message nil} ❯ echo $? 1 ``` and we have an exit code of 1 so that https://github.com/metabase/metabase/blob/master/.github/workflows/i18n.yml will fail in CI.
Please register or sign in to comment