Internationalization (i18n)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Starlight Recipes relies on Starlight’s built-in support for internationalization to provide multilingual support for your recipes with features like routing or fallback content.
See the Starlight internationalization documentation for more information on how to configure i18n in your Starlight website.
Configure i18n
Section titled “Configure i18n”-
Configure internationalization in your Starlight project by following the Starlight “Configure i18n” guide.
-
Create a directory for each language in
src/content/docs/based on your Starlight i18n configuration with arecipes/directory inside each language directory.For example, the following directory structure is created for English, French, and Chinese languages with no root locale:
Ordnersrc/
Ordnercontent/
Ordnerdocs/
Ordneren/
Ordnerrecipes/
- …
Ordnerfr/
Ordnerrecipes/
- …
Ordnerzh-cn/
Ordnerrecipes/
- …
-
You can now add content files in the
recipes/directories of your language directories. Use the same file name to associate recipes across languages.
Fallback content
Section titled “Fallback content”Similar to Starlight, Starlight Recipes expects you to create equivalent recipes in all your languages.
For example, if you have an en/recipes/virgin-colada.md file, create an virgin-colada.md for each other language you support.
This allows Starlight and the Starlight Recipes plugin to provide automatic fallback content for recipes that have not yet been translated.
Read more about fallback content in the Starlight “Internationalization” guide.
Translate the recipes UI
Section titled “Translate the recipes UI”The Starlight Recipes plugin allows you to translate the default UI strings used on your recipe website so that your recipes can be fully localized and readers can enjoy a seamless experience in their preferred language.
English and German translated UI strings are provided out of the box.
To provide translations for additional languages you support — or override the default ones — check the “Translate Starlight’s UI” guide in the Starlight documentation.
These are the English defaults of the existing strings Starlight Recipes ships with:
{ "starlightRecipes.authors.count_one": "{{count}} recipe by {{author}}", "starlightRecipes.authors.count_other": "{{count}} recipes by {{author}}", "starlightRecipes.categories.count_one": "{{count}} recipe with the category “{{category}}”", "starlightRecipes.categories.count_other": "{{count}} recipes with the category “{{category}}”", "starlightRecipes.cuisines.count_one": "{{count}} recipe with the cuisine “{{cuisine}}”", "starlightRecipes.cuisines.count_other": "{{count}} recipes with the cuisine “{{cuisine}}”", "starlightRecipes.pagination.next": "Further recipes", "starlightRecipes.pagination.prev": "Prior recipes", "starlightRecipes.recipe.calories": "Calories", "starlightRecipes.recipe.caloriesValue": "{{calories}} kcal", "starlightRecipes.recipe.date": "{{date, datetime(dateStyle: medium)}}", "starlightRecipes.recipe.draft": "Draft", "starlightRecipes.recipe.featured": "Featured", "starlightRecipes.recipe.ingredients.heading": "Ingredients", "starlightRecipes.recipe.ingredients.decreaseYield": "Decrease yield", "starlightRecipes.recipe.ingredients.increaseYield": "Increase yield", "starlightRecipes.recipe.ingredients.currentServingsAriaLabel": "Current servings", "starlightRecipes.recipe.ingredients.servings": "Servings", "starlightRecipes.recipe.instructions.confirmReset": "Confirm?", "starlightRecipes.recipe.instructions.done": "Done!", "starlightRecipes.recipe.instructions.heading": "Instructions", "starlightRecipes.recipe.instructions.reset": "Reset", "starlightRecipes.recipe.instructions.resetProgress": "Reset progress", "starlightRecipes.recipe.print": "Print Recipe", "starlightRecipes.recipe.published": "Published", "starlightRecipes.recipe.rating.alreadyVoted": "Already voted!", "starlightRecipes.recipe.rating.empty": "No ratings", "starlightRecipes.recipe.rating.serverError": "Server Error!", "starlightRecipes.recipe.rating.starLabel_one": "Rate {{count}} star", "starlightRecipes.recipe.rating.starLabel_other": "Rate {{count}} stars", "starlightRecipes.recipe.tags": "Tags:", "starlightRecipes.recipe.totalTime": "Total time", "starlightRecipes.recipe.video.heading": "Video", "starlightRecipes.sidebar.all": "All recipes", "starlightRecipes.sidebar.authors": "Authors", "starlightRecipes.sidebar.exploreAll": "Explore all recipes", "starlightRecipes.sidebar.featured": "Featured recipes", "starlightRecipes.sidebar.popular": "Popular recipes", "starlightRecipes.sidebar.tags": "Tags", "starlightRecipes.tags.count_one": "{{count}} recipe with the tag “{{tag}}”", "starlightRecipes.tags.count_other": "{{count}} recipes with the tag “{{tag}}”", "starlightRecipes.time.hours_one": "{{count}} hr", "starlightRecipes.time.hours_other": "{{count}} hrs", "starlightRecipes.time.minutes_one": "{{count}} min", "starlightRecipes.time.minutes_other": "{{count}} mins", "starlightRecipes.time.total_full": "$t(starlightRecipes.time.hours, {'count': {{hours}} }) $t(starlightRecipes.time.minutes, {'count': {{minutes}} })", "starlightRecipes.time.total_hours": "$t(starlightRecipes.time.hours, {'count': {{hours}} })", "starlightRecipes.time.total_minutes": "$t(starlightRecipes.time.minutes, {'count': {{minutes}} })", "starlightRecipes.recipe.instructions.startTimerAriaLabel": "Start {{minutes}} minute timer", "starlightRecipes.recipe.instructions.resetTimerAriaLabel": "Reset timer", "starlightRecipes.recipe.instructions.markStepDoneAriaLabel": "Mark step {{step}} as done", "starlightRecipes.recipe.instructions.stepAriaLabel": "Step {{step}}", "starlightRecipes.recipe.rating.groupLabel": "Recipe rating", "starlightRecipes.recipe.rating.starsGroupLabel": "Rate this recipe", "starlightRecipes.recipe.rating.loading": "Loading ratings", "starlightRecipes.recipe.ingredients.servingsUpdated": "Servings updated to {count}", "starlightRecipes.recipe.author.linkAriaLabel": "View more by {{name}}"}