PHP code example of boxblinkracer / phpunuhi
1. Go to this page and download the library: Download boxblinkracer/phpunuhi library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
boxblinkracer / phpunuhi example snippets
StorageFactory::getInstance()->registerStorage($myStorage);
ExchangeFactory:: getInstance()->registerExchangeFormat($myFormat);
TranslatorFactory::getInstance()->registerTranslator($myTranslator);
ScannerFactory::getInstance()->registerScanner($myScanner);
SpellCheckerFactory::getInstance()->registerSpellChecker($mySpellChecker);
\PHPUnuhi\AppManager::registerExtensionCommand(new CustomCommand());
xml
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/boxblinkracer/phpunuhi/config.xsd"
>
<translations>
<set name="Storefront">
<format>
<json/>
</format>
<locales>
<locale name="de">./snippets/storefront/de.json</locale>
<locale name="en">./snippets/storefront/en.json</locale>
</locales>
</set>
</translations>
</phpunuhi>
xml
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/boxblinkracer/phpunuhi/config.xsd"
>
<translations>
<set name="Storefront JSON">
<format>
<json indent="4" sort="true"/>
</format>
<locales>
<locale name="de">./snippets/de.json</locale>
<locale name="en">./snippets/%locale%.json</locale>
</locales>
</set>
<set name="Products">
<format>
<shopware6 entity="product"/>
</format>
<filter>
<exclude>
<key>meta_*</key>
</exclude>
</filter>
<locales>
<locale name="de-DE"/>
<locale name="en-GB"/>
</locales>
</set>
</translations>
</phpunuhi>
bash
php vendor/bin/phpunuhi validate:coverage
# provide custom configuration
php vendor/bin/phpunuhi validate:coverage --configuration=./translations.xml
bash
php vendor/bin/phpunuhi validate:structure
# provide custom configuration
php vendor/bin/phpunuhi validate:structure --configuration=./translations.xml
php vendor/bin/phpunuhi validate:spelling --service=aspell --configuration=./translations.xml
php vendor/bin/phpunuhi validate:similarity --configuration=./translations.xml
php vendor/bin/phpunuhi validate:similarity --threshold=80 --configuration=./translations.xml
bash
# Fixes all sets of the configuration
php vendor/bin/phpunuhi fix:mess
# Fixes only a provided set of your configuration
php vendor/bin/phpunuhi fix:mess --set="storefront"
bash
php vendor/bin/phpunuhi status
bash
php vendor/bin/phpunuhi list:translation-keys
bash
php vendor/bin/phpunuhi list:translations
bash
php vendor/bin/phpunuhi migrate --output=json
bash
php vendor/bin/phpunuhi services
xml
<set name="sample">
<format>
<json indent="4" sort="true"/>
</format>
<locales>
<locale name="de">./snippets/de.json</locale>
<locale name="en">./snippets/en.json</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<ini sort="true"/>
</format>
<locales>
<locale name="de">./snippets/de.ini</locale>
<locale name="en">./snippets/en.ini</locale>
</locales>
</set>
<set name="sample">
<format>
<ini sort="true"/>
</format>
<locales>
<locale name="de" iniSection="de-DE">./snippets/snippets.ini</locale>
<locale name="en" iniSection="en-GB">./snippets/snippets.ini</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<po/>
</format>
<locales>
<locale name="de">./snippets/de.php</locale>
<locale name="en">./snippets/en.php</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<php sort="true"/>
</format>
<locales>
<locale name="de">./snippets/de.php</locale>
<locale name="en">./snippets/en.php</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<yaml indent="4" sort="true"/>
</format>
<locales>
<locale name="de">./snippets/de.yaml</locale>
<locale name="en">./snippets/en.yaml</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<resx/>
</format>
<locales>
<locale name="de">./Resources.de.resx</locale>
<locale name="en">./Resources.en.resx</locale>
</locales>
</set>
xml
<set name="sample">
<format>
<strings/>
</format>
<locales>
<locale name="de">./de.lproj/Localizable.string</locale>
<locale name="en">./en.lproj/Localizable.string</locale>
</locales>
</set>
xml
<phpunuhi
bootstrap="./autoload.php">
</phpunuhi>
xml
<set>
<filter>
< </tom_fields</key>
<key>meta_*</key>
</exclude>
</filter>
</set>
xml
<set>
<rules>
<duplicateContent>false</duplicateContent>
<nestingDepth>3</nestingDepth>
...
</rules>
</set>
xml
<duplicateContent>
<locale name="de">false</locale>
<locale name="*">true</locale>
</duplicateContent>
xml
<emptyContent>
<key name="social_media.youtube.link">
<locale>*</locale>
</key>
<key name="social_media.facebook.link"/>
</emptyContent>
xml
<emptyContent>
<key name="social_media.youtube.link">
<locale>DE</locale>
<locale>IT</locale>
<locale>FR</locale>
</key>
</emptyContent>
xml
<phpunuhi
bootstrap="./autoload.php">
</phpunuhi>
xml
<phpunuhi
bootstrap="./autoload.php">
</phpunuhi>
xml
<coverage>
<locale name="de">100</locale>
<locale name="en">80</locale>
</coverage>
xml
<phpunuhi>
<translations>
<set name="Administration">
<format>
<json indent="2" sort="true" eol-last="true"/>
</format>
<locales>
<locale name="en">en.json</locale>
<locale name="de">de.json</locale>
</locales>
<coverage minCoverage="80">
<locale name="de">80</locale>
<locale name="en">80</locale>
</coverage>
</set>
</translations>
<coverage minCoverage="80">
<locale name="de">80</locale>
<locale name="en">80</locale>
</coverage>
</phpunuhi>