Jump to content

Making a module translateable


Recommended Posts

Hi there,

I worked on making apeisas great Thumbnail module translateable (I need a German translation of the UI), but can't really get it to work. I hope that someone here can give me a pointer in the right direction on this.

This is what I did:

1. Installed the LanguageSupport module via ModuleManager.

2. Added the German language pack to the Default language.

=> Everything worked great until now, the backend is mostly translated.

3. Since a lot of strings in Thumbnail weren't translateable, I went through the code and added $this->_() and __() where needed (referring to how it is done with core modules).

You can find this version here: https://github.com/boundaryfunctions/Thumbnails/tree/translateable

This is the commit adding translatable function: https://github.com/boundaryfunctions/Thumbnails/commit/c3bcb8af480d91bc8ee7cfd4477aadeeab6a708e

4. Using the Language Translator in the backend, I added translation files for each of the three module files of Thumbnail to my default language. I uploaded all three translation files I created (not the best translations at this point, to be honest) here: https://gist.github.com/d41fe1e71791fccf5cc4

5. All of the things I translated aren't translated in the backend, I'm still displayed plain English.

Any idea what I might have done wrong here? I really don't get it, because these steps worked perfectly for me until now. Any help is much appreciated.

With kind regards,


  • Like 1
Link to comment
Share on other sites

Thanks a lot for looking over it!

That's exactly the same thing that I thought, but still I can't get it to work, it's a pity. There is no kind of super-special translation cache or anything like this, that I'm not aware of, is it?

I'll set up a new PW instance to test this further...

Link to comment
Share on other sites

Thanks, but I already cleared the cache with no effect (only files related to ModuleManager in there either way).

Then I changed /site/modules/FiledtypeCropImage/ from the symbolic link that it was to be the actual files and now it's working! And the scales felt from my eyes, too...

For sure, a translation file called site--modules--fieldtypecropimage--fieldtypecropimage-module.json doesn't apply to a file physically stored somewhere else then /site/modules/FieldtypeCropimage/FieldtypeCropImage.module. Just didn't think about this thoroughly enough before.

So, for everyone running into this problem, too:

Don't try to translate a module that you just symbolically linked into the filesystem. It won't work!

Thanks for all your help here!  :)

  • Like 2
Link to comment
Share on other sites

Yep, and that is little shame. I symlink with wire folder and translations work fine. Would love to symlink site modules too. But as long ad they come from github updating is not an issue.

And of course always possible to create some server side scripts to keep modules up to date..

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 9 months later...

Haven't looked in here for a while, but now that I see it I still want to answer:

Speaking about unixoid OSes, hard links contrary to soft links are not distinguishable from "real files" - actually there isn't a "real" file because this also is only a hard link to an inode. All hard links to a file are equally important. So, didn't try it, but there's no possibility that it doesn't work with hard links.

About resolving the soft link problem: it is possible to check whether a given path is a softlink and if yes follow that link to the actual file to solve this in PHP without strains. This should even work in Windows from PHP >= 5.3.0 on, so maybe it's worth to give it a try?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...