Module development on non-english sites
Lately I've been working on a project in a non-english language. We usually do sites in english or multilanguage sites with english, so I'm kind of new on this projects. From the code perspective, when working on english sites, there is no problem at all, just use function t() with english text, but on a different language, what should be our approach?
Usually, the translations are not part of the development team but part of the clients job and in the future we will have to be sure that the client understands that the project will be delivered in english and we will provide them the tools for translating the site to the languages he wants. But for this time I had to look for a solution.
The easiest solution was to just don't use the t() function, but that is a bad practice. Even worse is using t() in other language than english. The obvious solution is to do it like if it was english: t() with english strings. But then, how do we provide the translations to the client?
An easy solution is to manually insert the translations during the installation of the module, but in order to keep the code clean and without code that is not related with the core functionality of the module I don't suggest this solution. So, back to the standards and the old ways.
The first tool that someone recommended me is the potx module that provides a tool to generate a .po file extracting all the strings from t() calls. It works quite well but don't extract the text if the translation string is passed using a variable, so you will have to manually add those lines or change your code.
But now we have another issue, how do we automate the process to import the files? Well, it's a deprecated solution but Drupal's core imports the .po files that are inside the module folder, so we are done!
As a footnote, if you are looking for a tool to edit the potx files, I suggest PoEdit, available for Linux systems.