diff --git a/docs/02-building-your-application/01-routing/08-internationalization.md b/docs/02-building-your-application/01-routing/08-internationalization.md index 2c5e918e6..a30d7529a 100644 --- a/docs/02-building-your-application/01-routing/08-internationalization.md +++ b/docs/02-building-your-application/01-routing/08-internationalization.md @@ -654,6 +654,8 @@ Will be transformed to this HTML in `es`: As long as you do not put the locale in the `href` of `a` tag, then no conversion is done. It is useful to change the language: ```tsx filename="src/components/change-locale.tsx" switcher +import { type RequestContext } from "brisa"; + export function ChangeLocale(props: {}, { i18n, route }: RequestContext) { const { locales, locale, pages, t } = i18n; @@ -675,6 +677,28 @@ export function ChangeLocale(props: {}, { i18n, route }: RequestContext) { } ``` +```js filename="src/components/change-locale.js" switcher +export function ChangeLocale(props: {}, { i18n, route }) { + const { locales, locale, pages, t } = i18n; + + return ( + + ); +} +``` + ## Leveraging the `BRISA_LOCALE` cookie Brisa supports overriding the accept-language header with a `BRISA_LOCALE=the-locale` cookie. This cookie can be set using a language switcher and then when a user comes back to the site it will leverage the locale specified in the cookie when redirecting from `/` to the correct locale location. diff --git a/src/create-brisa-app/create-brisa-app.sh b/src/create-brisa-app/create-brisa-app.sh index b493df817..99e6dd179 100755 --- a/src/create-brisa-app/create-brisa-app.sh +++ b/src/create-brisa-app/create-brisa-app.sh @@ -8,9 +8,9 @@ mkdir $PROJECT_NAME cd $PROJECT_NAME -echo "Creating package.json" +$BRISA_VERSION="0.0.6" -bun init -y +echo "Creating package.json" echo "Installing brisa" @@ -24,7 +24,7 @@ echo "{ \"start\": \"brisa start\" }, \"dependencies\": { - \"brisa\": \"0.0.6\" + \"brisa\": \"$BRISA_VERSION\" }, \"devDependencies\": { \"bun-types\": \"latest\" @@ -67,6 +67,39 @@ echo "{ }" > tsconfig.json +echo "# $PROJECT_NAME + +## Getting Started + +Project created with [Brisa](https://github.com/aralroca/brisa) v$BRISA_VERSION. + +### Installation + +\`\`\`bash +bun install +\`\`\` + +### Development + +\`\`\`bash +bun dev +\`\`\` + +### Build + +\`\`\`bash +bun build +\`\`\` + +### Start + +\`\`\`bash +bun start +\`\`\` + + +" > README.md + mkdir src mkdir src/pages touch src/pages/index.tsx @@ -80,4 +113,7 @@ echo "export default function Homepage() { bun install -cd .. \ No newline at end of file +cd .. + +echo "Project created successfully" +echo "Run: cd $PROJECT_NAME && bun dev" diff --git a/src/create-brisa-app/package.json b/src/create-brisa-app/package.json index 4343cf392..cedc6c81d 100644 --- a/src/create-brisa-app/package.json +++ b/src/create-brisa-app/package.json @@ -1,6 +1,6 @@ { "name": "create-brisa-app", - "version": "0.0.4", + "version": "0.0.5", "license": "MIT", "type": "module", "author": { @@ -17,4 +17,4 @@ "bin": { "create-brisa-app": "./create-brisa-app.sh" } -} \ No newline at end of file +}