Includes various adaptable I/O coverters.
Includes various converters which are adaptable to your needs.
Once composer is installed, run this in your terminal/command-line tool:
composer require wirecard/io-converter
In your application load the
vendor/autoload.php that Composer provides.
You can then initialize the
WppVTwoConverter class like so:
use Wirecard\Converter\WppVTwoConverter; $converter = new WppVTwoConverter(); $converter->init();
This automatically loads all the supported language codes for WPP v2.
The WPP v2 converter does support two types of input formats:
- ISO-639-1 (e.g. "en")
- ISO-639-1 - ISO-3166 (e.g. "en-US")
If the given input is valid, but is not supported within WPP v2 yet, the converter will return a fallback language. If the input is valid and supported the converter will return the correct code for usage within WPP v2.
(The fallback language code is default set to "en")
To convert your language codes to WPP v2 supported codes use the specified input formats and call the convert function:
$converter->convert("en-US"); // => "en"
$converter->convert("de"); // => "de"
If you pass a correct formatted language code which is not supported yet by WPP v2 you will get the fallback language code:
$converter->convert("zz"); // => "en"
Furthermore there is the possibility to set your own fallback language to "de" for example with
Please ensure that the language code you want to set as fallback is supported by WPP v2, else the fallback setting will not work.
Note that you have to send a valid language code format,
otherwise you will receive an
$converter->convert("en-USUS"); // => InvalidArgumentException
The correct format for input language code can be