\TransvisionDotlang

Dotlang class

This class is used to manipulat translation files in .lang format used in www.mozilla.org, firefox health report, start.mozilla.org, surveys and other small projects on svn mostly related to engagement.

Summary

Methods
Properties
Constants
getLangFilesList()
getFile()
getStrings()
generateStringID()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getLangFilesList()

getLangFilesList(string  $path) : array

Recursively find all lang files, ignore common VCS dot files

Parameters

string $path

Path to the directory to scan

Returns

array —

All the file paths

getFile()

getFile(string  $file) : array

Loads the lang file and returns a cleaned up array of the lines

Parameters

string $file

path to the local file to load

Returns

array —

All the significant lines in the file as an array

getStrings()

getStrings(string  $file, boolean  $reference_locale) : array

Loads strings from a .lang file into an array. File format is: ;String in english translated string

Parameters

string $file

.lang file to load

boolean $reference_locale

True if the current locale is the reference locale

Returns

array —

Array of strings as [original => translation]

generateStringID()

generateStringID(string  $file_path, string  $string) : string

Generate a unique id for a string to store that in Transvision with the unique ids for products. Since there are no names for strings we generate a short hash of the string.

Parameters

string $file_path

the file path to the .lang file

string $string

the English string

Returns

string —

unique id such as mozilla_org/mozorg/about.lang:a4a7eabd