ProductOpener::I18N - Reads the .po files from a certain directory and processes them.
ProductOpener::I18N
is used to read all ".po" files from a certain directory and merge them in one hash.
The singular & plural entries are separated into two hashes.
The module implements the functionality to read and process the .po files from a certain directory. The .po files are read and then merged into a single hash which is then separated into two hashes. One of these hashes have all plural entries and the other one has all singular entries. The functions used in this module take the directory to look for the .po files and returns two hashrefs.
read_po_files()
takes directory of the .po files as an input parameter,
reads and merges them in one hash That hash is returned as a reference.
(Done to spare the stack) Returning a reference uses a bit less memory since there's no copy.
This function also cleans up the %Lexicon from gettext metadata and cleans up the empty values that are put in .po files by Crowdin when the string is not translated.
The directory containing .po files are passed as an argument.
Returns a reference to a hash on successful execution.
split_tags()
takes the hashref returned by read_po_files as input parameter separates it into two hashes separated by if they are singular or plural,
respectively and returns them as 2 hashrefs.
A hash is passed as an argument.
If the function executes successfully it returns two hash references. If the tags are malformed, it throws a warning.