Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Seggewiß <39218577+seggewiss@users.noreply.github.com>
  • Loading branch information
jleifeld and seggewiss committed Feb 21, 2024
1 parent 44cef72 commit 599718a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions docs/docs/guide/6_faq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ While it is not possible to use the exact same components in the Shopware admini

To access the Meteor Component Library, visit the following link: https://github.com/shopware/meteor-component-library

## How can I use snippets for multi-language in my app?
## How can I use snippets to translate my app?

You can manage all text rendered within your app's [locations](../4_concepts/locations.md) with a translation plugin of your choice. If you're utilizing Vue.js as your frontend framework you can use the i18n plugin. Additionally, to ensure consistency between your app and the administration interface, you can synchronize language changes by [subscribing to them through the context API](../2_api-reference/context.md#subscribe-on-language-changes).
You can manage all texts rendered within your [locations](../4_concepts/locations.md) with a translation plugin of your choice. If you're utilizing Vue.js as your frontend framework, you can use the i18n plugin. Additionally, to ensure consistency between your app and the Shopware Administration, you can synchronize language changes by [subscribing to them through the context API](../2_api-reference/context.md#subscribe-on-language-changes).

For text elements outside your locations, such as titles within [component sections](../4_concepts/component-sections.md), you can employ snippet files within your app. Here's a how to accomplish this:

1. **Create Snippet Files:** Begin by generating a snippet file for each supported language within your app. These files should reside in the `Resources/app/administration/snippet` directory. Naming conventions follow the language code format, for instance, `en-GB.json` for English language support. The file structure mirrors that of administration snippets.
1. **Create Snippet Files:** Begin by generating a snippet file for each supported language within your app. These files should reside in the `Resources/app/administration/snippet` directory. Naming conventions follow the language code format, for instance, `en-GB.json` for English language support. The file structure mirrors that of administration snippets. However it is not impossible to overwrite Shopware Administration snippets.

```json
// <app root>/Resources/app/administration/snippet/en-GB.json
Expand All @@ -44,6 +44,4 @@ sw.ui.componentSection('sw-manufacturer-card-custom-fields__before').add({
locationId: 'my-app-card-before-properties'
}
})
```

Important: This only works for elements rendered inside the administration and not for elements rendered within your app's locations. For the latter, you should use the i18n plugin.
```

0 comments on commit 599718a

Please sign in to comment.