Multilingual
If your business or site doesn't require multiple languages, then we don't recommend enabling the multilanguage feature. It'll increase the complexity of maintaining all the language simultaneously. Only enable it if you know what multilanguage is and your business or site needs that feature.
Step 1: Enable Multilingual Feature
API:
At first open api -> .env
and make true of ``
TRANSLATION_ENABLED=true
Admin
For admin,
update admin -> .env
and update,
NEXT_PUBLIC_ENABLE_MULTI_LANG=true
And add available language to NEXT_PUBLIC_AVAILABLE_LANGUAGES
with a comma separator.
For example, at your site, you want to support three languages, one is English, and the rest of the two will be german and Arabic. Then NEXT_PUBLIC_AVAILABLE_LANGUAGES
will be like this,
NEXT_PUBLIC_AVAILABLE_LANGUAGES=en,de
Shop
For shop, similarly,
update shop -> .env
and update,
NEXT_PUBLIC_ENABLE_MULTI_LANG=true
And add available language to NEXT_PUBLIC_AVAILABLE_LANGUAGES
with a comma separator.
For example, at your site, you want to support three languages, one is English, and the rest of the two will be german and Arabic. Then NEXT_PUBLIC_AVAILABLE_LANGUAGES
will be like this,
NEXT_PUBLIC_AVAILABLE_LANGUAGES=en,de
After that, if you already host your site on server then make sure you redeploy the API and rebuild the frontend,
https://pixer-doc.vercel.app/faq#how-to-rebuild-the-project
Step 2: How to add new language in admin?
File Location
admin\public\locales\sg\banner.json
File Location
admin\src\utils\locals.tsx
File Location
admin\src\components\icons\flags\
Step 3: How to add new language in shop?
File Location
shop\public\locales\sg\common.json
File Location
shop\src\lib\locals.tsx
File Location
shop\src\components\icons\flags\
Step 4: How to translate static content for admin?
File Location
admin\public\locales\sg\common.json
Step 5: How to translate static content for shop?
File Location
shop\public\locales\sg\common.json
Step 6: How to translate content?
Now after successfully configuring the Multilingual follow this procedure to translate your existing content to another one.
Data Type
Now before starting the translation, you've to understand about dependent and non-dependent data at pixer.
At pixer, some data are required to create another data, and it's called dependent data, and the independent data is called non-dependent data.
For example,
To create product types, categories, tags, author, manufacture, attributes, etc are required.
And for coupons or settings, no prior data is required.
Now, to translate a product, you must have to translate layouts types, categories and tags first. Without that, when you translate a product, you can't add your categories or types as those data are not translated yet.
To simplify the process, we made a serial for you. Just follow this serial, and it'll make the process relatively easy.
1. Settings2. Order Status3. Layouts Type4. Tags5. Categories6. Products
Translate Settings
If you want to translate the settings,
just go to your admin -> settings
It'll open default language settings.
Then change the language from the navbar, and the settings page will be redirected,
Then update the text of the settings page and click save.
Translate Order Status
To translate the order status,
- Go to the order status page from the admin
- Then click
Three Dot
and Create translate, - Then translate the text and click Save.
Similarly, translate all the order status.
Translate Layouts Type, Tags, Categories:
Follow order status procedure to translate Layouts Type
, Tags
, and Categories
.
Translate Products
Similarly, just edit three dots and translate the product.
But during the translation, don't change the
SKU.
SKU for a product has to be similar for all languages. We calculate the quantity based on that field.
Translate Layouts Type
Step 6: How to add custom or solved broken font issue?
File Location
pixer-api\config\pdf.php
'font_path' => base_path('resources/fonts/'),'font_data' => ['example' => ['R' => 'example.ttf', // regular font'B' => 'example.ttf', // optional: bold font'I' => 'example.ttf', // optional: italic font'BI' => 'example.ttf', // optional: bold-italic font'useOTL' => 0xFF,'useKashida' => 75,]],
File Location
pixer-api\resources\fonts\
File Location
pixer-api\packages\marvel\stubs\resources\views\pdf\order-invoice.blade.phppixer-api\resources\views\pdf\order-invoice.blade.php
@if($language === "ex")<style type="text/css">body {font-family: Arial, sans-serif, example;}</style>@endif
If you are facing above the issue just replace these code.
File Location
pixer-api\config\pdf.php
'font_path' => base_path('resources/fonts/'),'font_data' => ['example' => ['R' => 'example.ttf', // regular font'B' => 'example.ttf', // optional: bold font'I' => 'example.ttf', // optional: italic font'BI' => 'example.ttf', // optional: bold-italic font// 'useOTL' => 0xFF,'useKashida' => 75,]],
If you face any issues with Multilingual, or you've any suggestions to improve the Multilingual feature, then please open a ticket at
RedQ Support