Directory structure
The theme supports both RTL (Right-to-Left) for Arabic and LTR (Left-to-Right) for English, with appropriate styling adjustments for each direction.
File structure
Locale files follow a hierarchical JSON structure organized by scope:Top-level keys
blocks
blocks
Translations for reusable components like header, footer, and promotional banners.Usage: Text that appears in components shared across multiple pages.Examples:
- Navigation menu items
- Footer links
- App download banners
- Search placeholders
- Cart button labels
pages
pages
Page-specific translations organized by page type.Usage: Content that only appears on specific pages.Examples:
- Cart page messages
- Order details labels
- Product page buttons
- Customer dashboard text
- Checkout form labels
common
common
Shared translations used across multiple contexts.Usage: Generic text that doesn’t belong to a specific component or page.Examples:
- Button labels (Save, Cancel, Delete)
- Status messages (Success, Error)
- Form validation messages
- Date and time formats
- Common phrases
English translations
Location:src/locales/en.json
Structure example
Key features
- Sentence case: English translations use standard sentence capitalization
- Natural phrasing: Text reads naturally for native English speakers
- Placeholder support: Variables like
:bank_namefor dynamic content
Arabic translations
Location:src/locales/ar.json
Structure example
Key features
- RTL support: Arabic text flows right-to-left
- Cultural adaptation: Translations adapted for Arabic-speaking audiences
- Placeholder support: Same variable system as English
Using translations in templates
Translations are accessed in Twig templates using thetrans filter:
Basic usage
With placeholders
Fallback behavior
Translation key naming
Follow these conventions when adding new translations:Naming guidelines
- Use
snake_casefor all keys - Be descriptive:
add_to_cartnotadd - Group related keys under parent objects
- Use present tense for actions:
edit_profilenotedited_profile - Include context in ambiguous cases:
cart_totalvsorder_total
Adding new translations
To add custom translations:-
Identify the scope:
- Component-specific →
blocks - Page-specific →
pages - Generic →
common
- Component-specific →
- Add to both locale files:
- Use in templates:
Always add translations to both
en.json and ar.json to maintain bilingual support. Missing translations will display the translation key instead of text.Common translation categories
Order and review management
The order page includes time-sensitive actions:Product options
Customizable product attributes:Bank offers and promotions
Payment promotions with dynamic content:RTL/LTR considerations
Automatic direction handling
The theme automatically applies the correct text direction:Style adjustments
Separate SCSS files handle directional styling:src/assets/styles/02-generic/rtl.scss- RTL-specific stylessrc/assets/styles/02-generic/ltr.scss- LTR-specific styles
Number and date formatting
Locale-aware formatting is handled by Salla platform:Best practices
Keep keys synchronized: Ensure both
en.json and ar.json have matching key structures, even if some translations are the same.Use descriptive keys: Translation keys should be self-documenting.
edit_profile_button is better than btn_1.Group by context: Organize translations logically by component or page to make them easier to find and maintain.
Test both languages: Always preview your changes in both Arabic and English to ensure proper rendering and layout.
Handle pluralization: For count-dependent text, use separate keys or placeholder logic to handle singular/plural forms correctly in both languages.
Translation workflow
- Development: Add English translations first
- Translation: Get professional Arabic translations
- Integration: Add to both locale files
- Testing: Test in both languages on all devices
- Review: Check text length and layout in both directions
Next steps
Customization
Learn how to customize the theme
Assets folder
Explore JavaScript and SCSS files