How to correctly format language settings in an extension file? #898
-
For the maillink extension I would like to offer more languages, for this I have used the following code: // Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
$this->yellow->system->setDefault("MailAddress", "");
$this->yellow->language->setDefaults(array(
"Language: en",
"MailLinktext: Drop me a line",
"Language: de",
"MailLinktext: Schreib mir ein paar Zeilen",
"Language: fr",
"MailLinktext: Contactez-moi",
"Language: it",
"MailLinktext: Scrivimi una riga"));
} Unfortunately, none of the strings are written into the yellow-language.ini. I have tested it several times in a fresh, current installation and only Test environment:
What else have I tried?
I am slowly at my wit`s end and claim that I probably have a typo in there somewhere. The only question is: Where? And since I haven't found any real guidance on this topic, I have a request: If anyone has the time and inclination to help me with the troubleshooting, here are the files: https://github.com/pftnhr/yellow-maillink/tree/unstable Thank you in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
What I can see at first glance is that your extension system and language settings are missing the correct formatting. Usually all extensions are using the format
I never tried another settings format, therefore don't know if this already solves your problem. At least your code will better fit into our coding standards if you are planning to publish your extension. BTW, please consider using spaces instead of tabs. 🙂 |
Beta Was this translation helpful? Give feedback.
-
The API for developers provides these methods:
Here's an example code:
Here's an example code, this does NOT work:
Here are some tips and further explanations. A key/value must not be empty, otherwise it will be ignored. Extensions should support the languages of the official website, which are Hope this helps and happy coding. |
Beta Was this translation helpful? Give feedback.
What I can see at first glance is that your extension system and language settings are missing the correct formatting. Usually all extensions are using the format
ExtensionsnameSetting: value
. Assuming your extension has the nameMaillink
, a correctly formated extension or language setting would look like: