How do I translate my theme?

Permalink
Ok, so here's what I went through so far:
1) I coded my theme
2) I t-stringed all the hardcoded texts (and they need to be hardcoded)
3) I exported the strings via poedit.
4) I translated them
5) I uploaded them to /themes/mytheme/languages/xx_XX/LC_MESSAGES
6) I set my site language in the config
7) They don't work

Do I have to write a controller for my theme in order for them to work?

VPenkov
 
goutnet replied on at Permalink Best Answer Reply
I might be wrong here, but I thought you need to include your theme in a package to add translations to it …
TheRealSean replied on at Permalink Reply
TheRealSean
Is this the case? do themes need to be within a package to translate them?
VPenkov replied on at Permalink Reply
VPenkov
Thanks man!

You've been a bit vague, but your response was the key to our solution.

So let's walk through what I did:
1) Let's say that my theme is called MoonGrab. Its directory is called 'moongrab'
2) I put the directory 'moongrab' into /packages/theme_moongrab/themes/ so it became /packages/theme_moongrab/themes/moongrab/ - there's my default.php, etc.
3) My /packages/theme_moongrab/themes/moongrab/controller.php looks like this:
<?php  
defined('C5_EXECUTE') or die(_("Access Denied."));
class ThemeMoongrabPackage extends Package {
   protected $pkgHandle = 'theme_moongrab';
   protected $appVersionRequired = '5.6';
   protected $pkgVersion = '1.0';
   public function getPackageDescription() {
      return t("Description goes here.");
   }
   public function getPackageName() {
      return t("MoonGrab");
   }
   public function install() {
      $pkg = parent::install();   
      PageTheme::add('moongrab', $pkg);

4) I put my translations in the /packages/theme_moongrab/languages/xx_XX/LC_MESSAGES
5) I installed my theme as a package instead of installing it as a theme
6) Now it works like a charm.

Thanks again!