Localizing static files such as images, CSS, and client-side scripts
Key Takeaway
To localize a static file, put only its translated version in a locale folder next to default, with the same file name and folder path. B2C Commerce falls back to the default folder for each file that the locale folder doesn't have.
Static files are the images, CSS files and client-side JavaScript files that a storefront sends to the browser as they are. B2C Commerce localizes them with translated copies in a folder named for a locale, next to the default folder. A shopper in that locale gets the locale version of a file when one exists and the default version when it doesn't.
Which static files to localize
Localize a static file when it holds locale-specific content. Examples include:
- Images with text, such as buttons, or with locale-specific symbols
- CSS files
- JavaScript files that contain text, such as English error messages
Static files start out in a folder named default. The default files sit in these folders:
| Default folder | Holds | |
|---|---|---|
| Cartridge | static/default | Default (English) button images, JavaScript files and CSS files |
| Content library | The site's static/default folder | Content, category and homepage images |
In the content library, localization applies to images with text overlay.