Julia-i18n / Gettext.jl

i18n for Julia
Other
11 stars 9 forks source link

_"foo" macro evaluation time #7

Open stevengj opened 1 year ago

stevengj commented 1 year ago

Currently, the module defines:

macro __str(s)
    gettext(s)
end

This seems questionable to me. The problem is that gettext(s) is evaluated at the time of macro expansion, which for a package will typically happen during the precompilation step

This has the advantage of incurring no runtime cost. But what if the user changes the locale, however? Existing packages won't be recompiled to reflect the new locale.

(One could, in principle, get the best of both worlds if there were a way to make the package cache dependent o the locale, so that packages using Gettext automatically get recompiled if the locale changes. I don't think there is currently a way to do this, however.)