Let’s say I’m from Argentina and i use the “spanish” translations (more on this later!).
Let’s say in “reports” i see text that i want to translate to the Argentinian standards. Which steps to take?
Let’s take a look.
I’m opening application/view/reports/sales_per_client.php in my favorite editor.
I see lots of text, but i also see this: <?php _trans('invoices_per_client'); ?> those are “translation strings”.
When the language is not “english” but for example “spanish” the text will get translated to Spanish (for example)
The story behind translation texts
Let’s say i’m in my report and it says something like this:
<?php echo 'Invoices per client'; ?>
Because the _trans() isn’t used, it’s very difficult for users from Argentina, Germany, Brazil to translate that text, correct?
This is why we try to use the _trans() function everywhere, so other users can translate it in their own language.
Inventing new translation texts
Back to <?php echo 'Invoices per client'; ?>, we need to find a way to translate it to Argentinian Spanish (in this case)
- Open
application/language/english/ip_lang.php - add a new line in this file:
'invoices_per_client' => 'Invoices Per Client', - Optionally add that same line in your Argentinian Spanish file.
- Replace
<?php echo 'Invoices per client'; ?>with<?php _trans('invoices_per_client'); ?>in theapplication/view/reports/sales_per_client.phpfile
Now, your text will be properly translated in to Argentinian Spanish
Translating existing translation texts
- Open
application/language/<your language>/ip_lang.php - Now you can change anything you like. It’s your language, it’s the file you’re using in your application.
Careful!:
Every time a new version of InvoicePlane comes out this file gets overwritten!
See “Crowdin”
Crowdin
Crowdin is a way to translate the english translation texts in to many, many languages
Browse to InvoicePlane v1 dashboard in Crowdin (don’t worry about that project name, it will get improved with InvoicePlane v2
You will see this ginormous list of languages:
Of course you will want to translate the Argentinian Spanish texts (It’s only 62% translated).
- Create an account
- Log in
And now you can start improving the translation texts
Conclusion
Every time a new version of InvoicePlane comez out the translations get downloaded from Crowdin
The 62% of Argentinian Spanish translations gets placed into the .zip file and then released
If your language is set to Argentinian Spanish, when you see <?php _trans('invoices_per_client'); ?> you know that this will happen:
- Look up translation in
application/language/<your language>/ip_lang.php
if translation doesn’t exist - fall back to
application/language/english/ip_lang.php
Texts like <?php echo 'Invoices per client'; ?> aren’t translated, that’s what we have the _trans() function for
