Writing your own importer
oTranCe allows to import existing language files into the system. Therefore, it needs to analyse the uploaded or pasted data and extract key-value pairs from it. The application already includes importers for common file structures like PHP-Arrays, CSV, OXID, Redaxo and Titanium.
If your current project language files are not covered by these ready-to-use importers you can build one by yourself, following this steps:
Creating necessary files
2 files need to be present:
The class file at modules/library/Import/MyNewImporter.php contains the logic (you can copy & rename an existing class). The importer class needs to implement the Msd_Import_Interface. It has to have 2 methods:
The getInfo() method simply renders the informational view, that is shown in the GUI when clicking on the i-icon. It should tell the user in which cases this importer can be used and which structure is required. The view is named similar to the importer (lowercase) and must be placed at modules/library/Import/views.
The extractData() method will get the file or textbox content as a string. It has to extract the key/value pairs and needs to return them as an associative array:
Please take a look at the existing importers to get an idea how you could achieve this.
When these 2 files are present, oTranCe will list them automatically on the import page.