Language File Conventions - GeSHi/geshi-1.0 GitHub Wiki

There are several conventions that are used in language files. For ease of use and readability, your language files should obey the following rules:

  • Indentation is 4 spaces, not tabs: Use spaces! as editors continiously screw up tabs there should be no tabs in your documents since it would look differently on every computer otherwise.
  • Strings are in single quotes: Every string in a language file should be in single quotes (‘), unless you are specifying a single quote as a quotemark or escape character, in which case they can be in double quotes for readability; or if you are specifying a REGEXP (see below). This ensures that the language file can be loaded as fast as possible by PHP as unnecessary parsing can be avoided.
  • Large arrays are multi-lined: An array with more than three or four values should be broken into multiple lines. In any case, lines should not be wider than a full-screen window (about 100 chars per line max). Don’t break the keywords arrays after every keyword.
  • Ending brackets for multi-lined arrays on a new line: Also with a comma after them, unless the array is the last one in a parent array. See the PHP language file for examples of where to use commas.
  • Use GeSHi’s constants: For capatalisation, regular expressions etc. use the GeSHi constants, not their actual values.
  • Verbatim header format: Copy the file header verbatim from other language files and modify the values afterwards. Don’t try to invent own header formats, as your languages else will fail validation!

There are more notes on each convention where it may appear in the language file sections below.