Skip to content

Commit

Permalink
i18n(es): translation of quick start to spanish (#3059)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Valladares <[email protected]>
  • Loading branch information
jcasben and dreyfus92 authored Dec 22, 2024
1 parent 3634f51 commit 74ed007
Show file tree
Hide file tree
Showing 9 changed files with 736 additions and 224 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ src/content/docs/learn/Security/using-plugin-permissions.mdx
src/content/docs/learn/Security/writing-plugin-permissions.mdx
src/content/docs/start/frontend/qwik.mdx
src/content/docs/zh-cn/start/frontend/qwik.mdx
src/content/docs/es/start/frontend/qwik.mdx
src/content/docs/learn/splashscreen.mdx
src/content/docs/security/http-headers.mdx
193 changes: 117 additions & 76 deletions src/content/docs/es/start/frontend/nextjs.mdx
Original file line number Diff line number Diff line change
@@ -1,90 +1,131 @@
---
title: Next.js
i18nReady: true
tableOfContents:
collapseLevel: 1
minHeadingLevel: 2
maxHeadingLevel: 5
---

import { Tabs, TabItem } from '@astrojs/starlight/components';
import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';
import CommandTabs from '@components/CommandTabs.astro';

Next.js es un framework para React. Aprende más sobre Next.js en https://nextjs.org. Esta guía es precisa a partir de Next.js 13.4.19.
Next.js es un meta framework para React. Aprende más sobre Next.js en https://nextjs.org. Esta guía es válida para Next.js 14.2.3.

## Checklist

- Usa exports estáticos estableciendo `output: 'export'`. Tauri no soporta soluciones basadas en el servidor.
- Usa `out/` como `distDir` en `tauri.conf.json`.
- Usa el directorio `out` como `frontendDist` en `tauri.conf.json`.

## Ejemplo de Configuración

1. Actualiza la configuración de Tauri:

<Tabs>
<TabItem label="npm">

```json
// tauri.conf.json
{
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"devPath": "http://localhost:3000",
"distDir": "../dist"
}
}
```

</TabItem>
<TabItem label="yarn">

```json
// tauri.conf.json
{
"build": {
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn generate",
"devPath": "http://localhost:3000",
"distDir": "../dist"
}
}
```

</TabItem>
<TabItem label="pnpm">

```json
// tauri.conf.json
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm generate",
"devPath": "http://localhost:3000",
"distDir": "../dist"
}
}
```

</TabItem>
</Tabs>

2. Actualiza la configuración de Next.js:

```ts
// next.conf.ts
const isProd = process.env.NODE_ENV === 'production';
module.exports = async (phase, { defaultConfig }) => {
// En modo de desarrollo usamos TAURI_DEV_HOST para servir los archivos si es necesario
const internalHost = process.env.TAURI_DEV_HOST || 'localhost';
const nextConfig = {
// Aségurate de que Next.js use SSG en lugar de SSR
// https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
output: 'export',
// Nota: Esta función experimental es necesaria para usar NextJS Image en modo SSG.
// Consulta https://nextjs.org/docs/messages/export-image-api para ver diferentes soluciones.
images: {
unoptimized: true,
},
// Configura assetPrefix o el servidor no resolverá correctamente tus archivos.
assetPrefix: isProd ? null : `http://${internalHost}:3000`,
};
return nextConfig;
};
```
<Steps>

1. ##### Actualiza la configuración de Tauri

<Tabs>

<TabItem label="npm">

```json
// src-tauri/tauri.conf.json
{
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"devUrl": "http://localhost:3000",
"frontendDist": "../out"
}
}
```

</TabItem>

<TabItem label="yarn">

```json
// src-tauri/tauri.conf.json
{
"build": {
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn build",
"devUrl": "http://localhost:3000",
"frontendDist": "../out"
}
}
```

</TabItem>

<TabItem label="pnpm">

```json
// src-tauri/tauri.conf.json
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devUrl": "http://localhost:3000",
"frontendDist": "../out"
}
}
```

</TabItem>

<TabItem label="deno">

```json
// src-tauri/tauri.conf.json
{
"build": {
"beforeDevCommand": "deno task dev",
"beforeBuildCommand": "deno task build",
"devUrl": "http://localhost:3000",
"frontendDist": "../out"
}
}
```

</TabItem>

</Tabs>

2. ##### Actualiza la configuración de Next.js

```ts
// next.conf.mjs
const isProd = process.env.NODE_ENV === 'production';

const internalHost = process.env.TAURI_DEV_HOST || 'localhost';

/** @type {import('next').NextConfig} */
const nextConfig = {
// Asegurate de que Next.js usa SSG en lugar de SSR
// https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
output: 'export',
// Nota: Esta función es necesaria para usar el componente Image de Next.js en modo SSG.
// Consulta https://nextjs.org/docs/messages/export-image-api para ver algunas soluciones alternativas.
images: {
unoptimized: true,
},
// Configura assetPrefix; de lo contrario, el servidor no resolverá correctamente tus recursos.
assetPrefix: isProd ? undefined : `http://${internalHost}:3000`,
};

export default nextConfig;
```

3. ##### Actualiza la configuración de package.json

```json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"tauri": "tauri"
}
```

</Steps>
Loading

0 comments on commit 74ed007

Please sign in to comment.