Salla Docs
Merchant API
  • Merchant API
  • Salla OAuth 2.0
Partner APIs
  • App API
  • Shipment API
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Change Log
Salla CLI
Merchant API
  • Merchant API
  • Salla OAuth 2.0
Partner APIs
  • App API
  • Shipment API
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Change Log
Salla CLI
Salla - Opensource
Salla - Developers Community
  1. Layouts
  • Getting Started
    • Create a theme
    • Develop a theme
    • Setup a theme
    • Publish a theme
  • Requirements & Review
    • Overview
    • Main Requirements
    • Review Process
      • UI / UX Review
      • Technical Review
      • Metadata Review
      • Pre-Launch Review
  • Files and Folders Structure
    • Directory structure
    • Twilight.json
  • Twig Template Engine
    • Basic syntax
    • Twilight flavoured twig
  • Theme Architecture
    • Layouts
      • Overview
      • Master Layout
      • Global Variables
      • CSS Variables
      • Salla Icons
      • Custom Fonts
      • Hooks
      • Localizations
    • Pages
      • Overview
      • Home Page
      • Product Pages
        • Products listing
        • Single product
      • Customer Pages
        • Profile
        • Orders list
        • Order details
        • Wishlist
        • Notifications
      • Blog Pages
        • Blog listing
        • Single blog
      • Brand Pages
        • Brands listing
        • Single brand
      • Common Pages
        • Cart
        • Loyalty
        • Thank you
        • Single page
        • Landing Page
    • Componenets
      • Overview
      • Home Components
        • Youtube
        • Fixed banner
        • Testimonials
        • Parallax background
        • Photos slider
        • Store features
        • Square photos
        • Fixed products
        • Products slider
        • Featured products - Style 1
        • Featured Products - Style 2
        • Featured Products - Style 3
        • Brands
        • Enhanced Square Banners
        • Main Links
        • Enhanced Slider
        • Slider Products with Headers
        • Latest Products
        • Vertical Menu with Slider
      • Product Components
        • Essentials
        • Options
      • Common Components
        • Header Components
        • Footer Components
        • Comments component
  • Change Log
  1. Layouts

Localizations

Twilight's localization feature makes it simple to extract strings in other languages, allowing Salla theme developers to effortlessly support multiple languages.
Information
In order to help merchants reach more people, Salla has chosen to support multilingual stores. This is a very effective way for them to reach a larger audience.
In this article, we will explore the localization:
Files location
Configuration
Translation retrieval
Supported Languages

Localization files location#

The localization files, which are JSON based files, are located in the locales directory src/locales/ and are used to define translation strings. This directory will contain a JSON file for each language supported by the theme. For applications with a large number of translatable strings, this strategy is recommended.
Information
Supporting multiple languages is known as internationalization, or i18n (18 letters separate the i and n). Twilight i18n provides the developer with access to many translations that are ready made for your Twilight Theme.
Note
You can find a complete list of all the language translation files supported by Twilight here
Following is the location of the localization files:
...
└── src 
    ├── locales
      ├── ar.json
      ├── en.json
      .....
      ├── your-language-code.json  
...

Configuration#

The localization file is a list of key-value pairs, e.g. "Key":"Value", that can be found in a JSON string file. A colon sign : separates the key and value strings, which are then enclosed by a main key value that groups the key-value pairs according to their intended purpose. Below is a very basic JSON structure with a main key value and a list of key-value pairs for translation.
For example, the localization file for the Arabic language locales/ar.json can be as follows:

Best practices for Localizations
1.
All texts should be in 3 levels, eg. level1.level2.level3.
2.
All keys used on Salla platforms can be found here. In this essential directory, use the search box to find the specific key you need, then click to copy it. Additionally, ensure you incorporate the Localization file into the designated filepath.

Translation retrieval#

For retrieving the translation strings, the developer can simply use the default helper trans() function. This helper translates the passed key to the current store language. Retrieving the translation can be done in different ways:
Simple key:
Key with variable:
Key with enforced locale/language:
A thing to know!
Arabic and English Languages should be supported when adding new keys.
By default English Language is set as a fallback language.
The developer can override, an existing translation, for example override الإضافة إلى السلة to تبرع الآن. Learn more about overriding process here.

Supported Languages#

Following is the list of the supported langauges by Twilight:
CodeLanguage
arالعربية
enEnglish
sqshqip
hyհայերէն
bgбългарски
zh汉语
hrhrvatski
csčeština
dadansk
nldutch
eteesti keel
fisuomen kieli
frfrançais
deDeutsch
elΕλληνικά
heעִבְרִית
hiहिन्दी
humagyar
indbahasa Indonesia
gaGaeilge
ititaliano
ja日本語
ko한국어
lvlatviešu
mtMaltese
faفارسی
plPolish
ptportuguês
roromână
ruрусский
slslovenščina
esespañol
svsvenska
tlTagalog (Filipino)
trTürkçe
ukукраї́нська
urاُردُو
Educational Clip
Modified at 2025-03-04 12:54:02
Previous
Hooks
Next
Pages