Difference between revisions of "Addons:Language"

From GExtension Wiki
Jump to navigation Jump to search
(Created page with "Language files should be named after this pattern: <2-digit-country-code>.php For example de.php, fr.php or en.php == Content == The file must contain the following to acces...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Language files should be named after this pattern: <2-digit-country-code>.php
+
Language files should be named after this pattern: <2-digit-country-code>.json
  
For example de.php, fr.php or en.php
+
For example de.json, fr.json or en.json
  
 
== Content ==
 
== Content ==
The file must contain the following to access the language variable:
+
The file must contain a json dictionary with the language-keys as keys and the translations as values :
  global $language;
+
{
 +
  "category_create": "Create Category",
 +
  "payment_pending": "Your payment is pending...",
 +
  ...
 +
  }
  
After that, language strings can be added with the pattern $languag['<identifier>'] = '<translation>'. For example:
+
 
$language['changes_unsaged'] = 'Unsafed Changes';
+
[[Category:Addons]]
$language['category_create'] = 'Create Category';
 
$language['payment_pending'] = 'Your payment is pending...';
 
...
 

Latest revision as of 14:22, 27 December 2020

Language files should be named after this pattern: <2-digit-country-code>.json

For example de.json, fr.json or en.json

Content

The file must contain a json dictionary with the language-keys as keys and the translations as values :

{
  "category_create": "Create Category",
  "payment_pending": "Your payment is pending...",
  ...
}