Skip to content

Commit b42deea

Browse files
committed
fix: update French localization for "Getting Started" text and enhance YAML hero actions handling
1 parent 6341973 commit b42deea

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

docs/src/content/docs/fr/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ hero:
77
file: ../../../assets/logo.svg
88
alt: GenAIScript logo A yellow square with genai text
99
actions:
10-
- text: Getting Started
10+
- text: Prise en main
1111
link: /genaiscript/getting-started/
1212
icon: right-arrow
1313
variant: primary

docs/translations/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8388,7 +8388,7 @@
83888388
"7488F1ED2F90893B552C": "Neovim",
83898389
"4C1CD4854A9D61A5024A": "Extension Visual Studio Code <a id=\"visual-studio-code-extension\" href=\"\" />\n\nLe [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=genaiscript.genaiscript-vscode)\ncontient la dernière version stable de l'[extension](https://marketplace.visualstudio.com/items?itemName=genaiscript.genaiscript-vscode).\n\n<Steps>\n <ol>\n <li>\n Installez [Visual Studio Code](https://code.visualstudio.com/Download).\n\n Visual Studio Code est un éditeur de code source léger mais puissant qui fonctionne sur votre bureau et est disponible pour Windows, macOS et Linux.\n </li>\n\n <li>\n Ouvrez le dossier de votre projet dans Visual Studio Code.\n </li>\n\n <li>\n Cliquez sur la vue **Extensions**\n\n <Image src={extensionViewSrc} alt={extensionViewAlt} />\n </li>\n\n <li>\n Recherchez **genaiscript** et cliquez sur **Installer**.\n\n <Image src={marketplaceSrc} alt={marketplaceAlt} />\n </li>\n\n <li>\n Si l'installation est réussie, vous verrez l'icône dans la vue **Extensions**.\n\n <Image src={vscodeViewSrc} alt={vscodeViewAlt} />\n </li>\n\n <li>\n (Facultatif) Cliquez sur l'icône ⚙️ sur la page de l'extension et sélectionnez **Ajouter aux recommandations de l'espace de travail**.\n </li>\n </ol>\n</Steps>\n\nPour installer une version spécifique de l'extension, nous recommandons de stocker le fichier `genaiscript.vsix`\ndans votre dépôt et d'utiliser les étapes d'installation manuelle.\n\n### Profil par défaut pour le terminal\n\nGenAIScript lance un serveur Node dans le terminal par défaut. Si le terminal par défaut n'est pas configuré\nou ne prend pas en charge Node.js, vous devrez peut-être le mettre à jour dans vos paramètres utilisateur/espace de travail.\n\n* Ouvrez la palette de commandes `Ctrl+Shift+P` et recherchez `Terminal: Sélectionner le profil par défaut`.\n* Sélectionnez le profil de terminal comme **Git Bash**",
83908390
"D729716A2DF6E7B14A5C": "Ligne de commande <a id=\"command-line\" href=\"\" />\n\nL'outil en ligne de commande [genaiscript](/genaiscript/reference/cli/) vous permet d'exécuter votre GenAIScript\ndepuis n'importe quel terminal.\n\n```sh\nnpx genaiscript run my-script some/path/*.pdf",
8391-
"4A5339853316F3D12027": "Commencer",
8391+
"4A5339853316F3D12027": "Prise en main",
83928392
"B59803282C64DBC3CD0B": "Commencez à développer avec l'extension GenAIScript pour VS Code afin de créer des scripts IA efficacement.",
83938393
"7CD15446D60D2DFAB9B4": "GenAIScript est un langage de script qui intègre les LLM dans le processus de script en utilisant une syntaxe JavaScript simplifiée.\nPris en charge par notre extension VS Code GenAIScript, il permet aux utilisateurs de créer, déboguer et automatiser des scripts basés sur LLM.",
83948394
"42FBD893AA9A93AD9F70": "Préambule",

packages/sample/genaisrc/mdtranslator.genai.mts

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,28 @@ export default async function main() {
195195
dbg(`yaml node: %s`, nhash);
196196
const data = parsers.YAML(node.value);
197197
if (data) {
198+
if (starlight) {
199+
if (Array.isArray(data?.hero?.actions)) {
200+
data.hero.actions.forEach((action) => {
201+
if (typeof action.text === "string") {
202+
const nhash = hashNode(action.text);
203+
const tr = translationCache[nhash];
204+
dbg(`yaml hero.action: %s -> %s`, nhash, tr);
205+
if (!tr) action.text = tr;
206+
else {
207+
const llmHash = `T${Object.keys(llmHashes).length.toString().padStart(3, "0")}`;
208+
llmHashes[llmHash] = nhash;
209+
llmHashTodos.add(llmHash);
210+
action.text = `┌${llmHash}${data.title}${llmHash}┘`;
211+
}
212+
}
213+
});
214+
}
215+
if (data?.cover?.image) {
216+
data.cover.image = patchFn(data.cover.image);
217+
dbg(`yaml cover image: %s`, data.cover.image);
218+
}
219+
}
198220
if (typeof data.title === "string") {
199221
const nhash = hashNode(data.title);
200222
const tr = translationCache[nhash];
@@ -348,13 +370,29 @@ export default async function main() {
348370
if (node.type === "yaml") {
349371
const data = parsers.YAML(node.value);
350372
if (data) {
351-
if (starlight && data?.hero?.image?.file) {
352-
data.hero.image.file = patchFn(data.hero.image.file);
353-
dbg(`yaml hero image: %s`, data.hero.image.file);
354-
}
355-
if (starlight && data?.cover?.image) {
356-
data.cover.image = patchFn(data.cover.image);
357-
dbg(`yaml cover image: %s`, data.cover.image);
373+
if (starlight) {
374+
if (data?.hero?.image?.file) {
375+
data.hero.image.file = patchFn(data.hero.image.file);
376+
dbg(`yaml hero image: %s`, data.hero.image.file);
377+
}
378+
if (Array.isArray(data?.hero?.actions)) {
379+
data.hero.actions.forEach((action) => {
380+
if (typeof action.text === "string") {
381+
const nhash = hashNode(action.text);
382+
const tr = translationCache[nhash];
383+
dbg(`yaml hero.action: %s -> %s`, nhash, tr);
384+
if (tr) action.text = tr;
385+
}
386+
if (action?.image?.file) {
387+
action.image.file = patchFn(action.image.file);
388+
dbg(`yaml hero action image: %s`, action.image.file);
389+
}
390+
});
391+
}
392+
if (data?.cover?.image) {
393+
data.cover.image = patchFn(data.cover.image);
394+
dbg(`yaml cover image: %s`, data.cover.image);
395+
}
358396
}
359397
if (typeof data.title === "string") {
360398
const nhash = hashNode(data.title);

0 commit comments

Comments
 (0)