Skip to content

translation fns with arguments that return hiccup vectors fail #37

@logseq-cldwalker

Description

@logseq-cldwalker

Hi @tonsky. With 0.4.4, I've started using arbitrary functions for translations recently and they work great for returning hiccup vectors with no arguments. However, when I pass arguments to these functions, I get a failure with trying to return a hiccup vector e.g.:

;; Invocation
(t :settings-permission/grant-permission "some-value-from-an-app-fn")
;; Dictionary entry
:settings-permission/grant-permission (fn [dir] [:p "Grant native filesystem permission for directory: " [:b dir]])

;; Results in
Error: No protocol method IInterpolate.interpolate-positional defined for type cljs.core/PersistentVector: [:p "Grant native filesystem permission for directory: " [:b "trash-notes"]]
    at Object.cljs$core$missing_protocol [as missing_protocol] (./js/cljs-runtime/cljs.core.js:314:9)
    at tongue$core$IInterpolate$interpolate_positional$dyn_234987 (./js/cljs-runtime/tongue.core.js:159:17)
    at Object.tongue$core$interpolate_positional [as interpolate_positional] (./js/cljs-runtime/tongue.core.js:170:8)

The reason I'm returning hiccup for some cases is because I need to support formatting in a phrase while allowing a language to choose word order e.g. this 3 word Turkish example. Happy to submit a PR for this if you're willing. Any code pointers appreciated. Thanks again for the handy library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions