-
- Downloads
Wrap `tru` and `trs` macro results in `str` (#10571)
* Add versions of `trs` and `tru` that wrap results in `str` The pre-existing `trs` and `tru` were renamed to `lazy-trs` and `lazy-tru` respectively, and new `trs` and `tru` funcs were added, wrapping the result of its lazy counterpart in `str`. This way the normal use case of `trs` and `tru` is improved by no longer requiring that it be wrapped in `str`. Cases where the translated result is passed to `str` anyway, the lazy version can be used. * `(str (trs ...))` → `(trs ...)` And the same for `tru`. * Allow `defsetting` descriptions to use lazy versions of `trs`/`tru` * Use `lazy-trs`/`lazy-tru` where `str` is applied separately * Remove unnecessary `vec` from `tru`/`trs` macros * puppetlabs.i18n does not have a `lazy-tru` * Missed some settings that now need to use `lazy-tru` * Only use `lazy-tru` in top-level `def`s If the localized strings are looked up on module import, before locales are loaded, the lookup will fail and the original input string will be used. * Fix bad usages of `tru` that should be `lazy-tru` * s/lazy-tr/deferred-tr/g * Avoid `tr*` macros being used in top-level (compile time) statements Because localizations are not yet loaded at compile time. * Add type hint for `str*` wrapping of `trs`/`tru` * Fix assigned function's return type hint * Expand docstrings for `i18n/tr[su]` * Use `trs` and `tru` from metabase.util.i18n instead of puppetlabs.i18n.core * Defer compile time translation lookups These changes were pointed out by exceptions generated by `i18n/str*`. * Remove unused `require`d function * New compile time `trs` usages caught by `lein uberjar` * Ensure that error message from db driver is a string It is necessary to ensure that the error message is a string, because some db driver errors come from statically declared error messages, using `deferred-tru`. Like those in `metabase.driver.common/connection-error-messages`. Fixes #10347 and #10473. * Remove string type hint from `humanize-connect-error-message`
Showing
- src/metabase/public_settings.clj 26 additions, 26 deletionssrc/metabase/public_settings.clj
- src/metabase/public_settings/metastore.clj 6 additions, 6 deletionssrc/metabase/public_settings/metastore.clj
- src/metabase/pulse.clj 7 additions, 7 deletionssrc/metabase/pulse.clj
- src/metabase/pulse/render.clj 1 addition, 1 deletionsrc/metabase/pulse/render.clj
- src/metabase/pulse/render/body.clj 6 additions, 6 deletionssrc/metabase/pulse/render/body.clj
- src/metabase/pulse/render/datetime.clj 10 additions, 10 deletionssrc/metabase/pulse/render/datetime.clj
- src/metabase/pulse/render/sparkline.clj 1 addition, 1 deletionsrc/metabase/pulse/render/sparkline.clj
- src/metabase/query_processor.clj 4 additions, 4 deletionssrc/metabase/query_processor.clj
- src/metabase/query_processor/middleware/add_implicit_clauses.clj 2 additions, 2 deletions...abase/query_processor/middleware/add_implicit_clauses.clj
- src/metabase/query_processor/middleware/add_implicit_joins.clj 8 additions, 8 deletions...etabase/query_processor/middleware/add_implicit_joins.clj
- src/metabase/query_processor/middleware/annotate.clj 23 additions, 23 deletionssrc/metabase/query_processor/middleware/annotate.clj
- src/metabase/query_processor/middleware/async.clj 2 additions, 2 deletionssrc/metabase/query_processor/middleware/async.clj
- src/metabase/query_processor/middleware/async_wait.clj 2 additions, 2 deletionssrc/metabase/query_processor/middleware/async_wait.clj
- src/metabase/query_processor/middleware/binning.clj 4 additions, 4 deletionssrc/metabase/query_processor/middleware/binning.clj
- src/metabase/query_processor/middleware/check_features.clj 1 addition, 1 deletionsrc/metabase/query_processor/middleware/check_features.clj
- src/metabase/query_processor/middleware/expand_macros.clj 5 additions, 4 deletionssrc/metabase/query_processor/middleware/expand_macros.clj
- src/metabase/query_processor/middleware/fetch_source_query.clj 2 additions, 2 deletions...etabase/query_processor/middleware/fetch_source_query.clj
- src/metabase/query_processor/middleware/parameters/sql.clj 6 additions, 6 deletionssrc/metabase/query_processor/middleware/parameters/sql.clj
- src/metabase/query_processor/middleware/permissions.clj 3 additions, 3 deletionssrc/metabase/query_processor/middleware/permissions.clj
- src/metabase/query_processor/middleware/process_userland_query.clj 3 additions, 3 deletions...ase/query_processor/middleware/process_userland_query.clj
Loading
Please register or sign in to comment