Approach to Multi-lingual texts
#89
Open
opened 4 years ago by zachmandeville
·
2 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hello!
I have a small pollen zine that just got a translation. I wanted to include the translated text into the zine, but wasn't sure the best way to approach it and curious on if any of you have done this, and the approach you took!
I would want to have two different outputted zines: one in English and one in Spanish. I was thinking I could add some logic so that an arg passed to
raco pollen render
would render it with the translation. One way would be to maybe have two different .ptree files, one for the english files and one for the spanish, and I just tell render which ptree file to look at? Ideally, though, I think I'd want to have each file be multi-lingual, as it'd make navigating the source a bit easier. So I would have two different sections per language, and then have the render be able to set which one gets picked up?Hopefully that makes sense, thank you!
I have a defunct personal website that attempts at this problem. I use an environment variable
LANG
to control which language I am in, then I simply callraco pollen render
several times on different values ofLANG
. In a source file, I can use tags namedlang/<lang-code>
(e.g.,lang/en
,lang/th
) where the content in the tag will only appear whenLANG
is set to<lang-code>
. The output HTML for eachLANG
are in completely separated directories, but that works well for me.You can inspect any environment variable from within a tag function using
getenv
(that’s a Racket thing, not a Pollen thing)