Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Gettext for Xslate #50
So I was bored again :)
While I usually prefer my software in English, I blog in German and would like the theme boilerplate (New Articles, Search, Posted on etc.) to be in German, too. Nevertheless I wanted to keep publishing my Chronicle theme on Github as an example for using Xslate-based themes. Im far too lazy to maintain two themes in sync for all but the texts though, so that was not an option.
and by simply adding a
Just as a demo, the above theme is now available in English, German, Spanish and Portuguese :)
Of course the
There is a new test for this stuff included that also shows the essence of how it's meant to be used.
Sorry for the slow reply on this - It took me a while to decide whether this was a feature that was useful, and desirable. I think the core idea of offering i18n in some fashion is good.
But I have to admit that I use Debian almost exclusively, and the Text::xslate module is not packaged for this - meaning if I accept this pull request I cannot use the project any more. I see that
At the moment your code seems to abort on failure:
In an ideal world i18n would be supported by all themes, all strings would be translatable, but for me to accept the solution it has to work on a Debian system, with packages that are packed for the stable release - at least.
Now that you've shown how it might work I think I'll go look for examples of other projects that are translatable/translated and see if there is a decent approach we can all be happy with.
PS. As you say dates/times are a mess. If we can come up with a solution for the templates I'm not averse to breaking compatibility with a new major release, if that cleans up inconsistencies..
Well, that's a pity with Xslate on Debian. I read it's in sid already but won't be in stable until the next release. What could work is to write a Template Toolkit module -- it shouldn't be much different from Xslate and all the XslateTT theme stuff should work on TT as well, plus TT has been in Debian forever.