-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
The one thing I've been worried about is how _"..." strings compose within Julia's package system, because they currently use the global textdomain setting.
- One perspective is that most individual packages shouldn't need translations, because they don't provide user interfaces — this is only done at the top application level. So there is only a single translation "domain" for the application.
- However, there are packages that open up user interface windows, like @timholy's ImageView.jl package — shouldn't each such package be able to have its own translations, in its own
podirectory?
One option is for _"..." to expand to gettext(GETTEXT_DOMAIN, "..."), where GETTEXT_DOMAIN is somehow relative to the current @__MODULE__. e.g. we could require that any module using _"..." defines a constant GETTEXT_DOMAIN to be the domain string.
That is, to use _"..." in a package, you would do something like:
module Foo
using Gettext
const GETTEXT_DOMAIN = "Foo-<uuid>"
function __init__()
bindtextdomain(GETTEXT_DOMAIN, joinpath(@__DIR__, "..", "po"))
end
# ...
endat which point _"..." should work, but you would have to explicitly pass GETTEXT_DOMAIN to ngettext etc. I guess we could define an @ngettext macro that does this for you.
The above still seems a little awkward, though. Not sure what the cleanest solution is here?
Metadata
Metadata
Assignees
Labels
No labels