# Add translations (switch locale)

## Step-by-step guide

{% hint style="info" %}
Local setup is required to add translations.
{% endhint %}

{% content-ref url="/pages/-MVHFGHdeRMq\_K7FMnhU" %}
[Code customization and local setup](/project-development/code-customization-and-local-setup.md)
{% endcontent-ref %}

1. Ensure that you are running `"@scandipwa/scandipwa": "x.x.x"`. You can check within `scandipwa/package.json` file. &#x20;
2. Set up the project locally by following these [instructions](https://help.readymage.com/faq/know-how-for-developers#how-can-i-set-up-the-project-locally-and-start-the-development).
3. Navigate to `scandipwa` folder within your source code folder.
4. Run command from the terminal `npm i @scandipwa/webpack-i18n-runtime`
5. Remove hardcoded locale from `app/etc/config.php` file by deleting the following lines of code:\
   `'general' => [`

   &#x20;               `'locale' => [`

   &#x20;                   `'code' => 'en_US'`

   &#x20;               `]`

   &#x20;           `],`
6. Open `scandipwa/package.json` file.
7. Add the locales you wish to have and `@scandipwa/webpack-i18n-runtime` extension, for example: \
   `"scandipwa": {`

   &#x20;       `"type": "theme",`

   &#x20;       `"locales": {`

   &#x20;           `"en_US": true,`

   &#x20;           `"fr_FR": true`

   &#x20;       `},`

   &#x20;       `"parentTheme": "@scandipwa/scandipwa",`

   &#x20;       `"extensions": {`

   &#x20;           `"@scandipwa/webpack-i18n-runtime": true`

   &#x20;       `}`

   &#x20;   `},`
8. Navigate to scandipwa folder and build your ScandiPWA theme to create added translation files by running the following command: `BUILD_MODE=magento npm run start`
9. Add your translations within generated locale file which is located in scandipwa/i18n folder.
10. Navigate to the repository root folder and run: `npm run start`
11. In Magento admin go to Stores > Configuration > General > General > Locale Options.
12. Switch to your store's scope and change the Locale to the one you created.
13. Clear cache by going to System > Tools > Cache Management and pressing Flush Cache Storage and Flush Magento Cache.
14. Open Frontend to ensure that translations are active.
15. Push all the changes to your repository.
16. Once the changes are deployed, enable access instance using SSH following these [instructions](/application-management/ssh-access.md).
17. Run the following command to enable developer mode: `magento deploy:mode:set developer`
18. Change the locale for the store view through your instance admin panel.
19. Clear cache by going to System > Tools > Cache Management and pressing Flush Cache Storage and Flush Magento Cache.
20. Run the following commands from your SSH:\
    `magento in:rei`\
    `magento c:c`\
    `magento deploy:mode:set production`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.readymage.com/project-development/add-translations-switch-locale.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
