### Install @tolgee/react Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/react/next/pages_router.mdx Install the necessary package for React integration. ```sh npm install @tolgee/react ``` -------------------------------- ### Full Configuration Example (.env) Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx This example demonstrates a complete set of environment variables for configuring a self-hosted Tolgee instance. It covers server port, database connection details, URLs for backend, file storage, and frontend, as well as various authentication and batch processing settings. ```env SERVER_PORT=8080 SPRING_DATASOURCE_URL= SPRING_DATASOURCE_USERNAME= SPRING_DATASOURCE_PASSWORD= TOLGEE_BACK_END_URL= TOLGEE_FILE_STORAGE_URL= TOLGEE_FRONT_END_URL= TOLGEE_MAX_SCREENSHOTS_PER_KEY=20 TOLGEE_MAX_TRANSLATION_TEXT_LENGTH=10000 TOLGEE_MAX_UPLOAD_FILE_SIZE=51200 TOLGEE_TRANSLATIONS_VIEW_LANGUAGES_LIMIT=-1 TOLGEE_AUTHENTICATION_ALLOWED_EMAIL_DOMAINS=[] TOLGEE_AUTHENTICATION_BLOCK_DISPOSABLE_EMAILS=true TOLGEE_AUTHENTICATION_BLOCK_EMAIL_ALIASES=true TOLGEE_AUTHENTICATION_BLOCKED_EMAIL_DOMAINS=[] TOLGEE_AUTHENTICATION_CREATE_DEMO_FOR_INITIAL_USER=true TOLGEE_AUTHENTICATION_ENABLED=true TOLGEE_AUTHENTICATION_INITIAL_PASSWORD= TOLGEE_AUTHENTICATION_INITIAL_USERNAME=admin TOLGEE_AUTHENTICATION_JWT_EXPIRATION=604800000 TOLGEE_AUTHENTICATION_JWT_SECRET= TOLGEE_AUTHENTICATION_JWT_SUPER_EXPIRATION=3600000 TOLGEE_AUTHENTICATION_NATIVE_ENABLED=true TOLGEE_AUTHENTICATION_NEEDS_EMAIL_VERIFICATION=false TOLGEE_AUTHENTICATION_REGISTRATIONS_ALLOWED=false TOLGEE_AUTHENTICATION_SECURED_IMAGE_RETRIEVAL=false TOLGEE_AUTHENTICATION_SECURED_IMAGE_TIMESTAMP_MAX_AGE=7200000 TOLGEE_AUTHENTICATION_USER_CAN_CREATE_ORGANIZATIONS=true TOLGEE_AUTHENTICATION_GITHUB_AUTHORIZATION_URL=https://github.com/login/oauth/access_token TOLGEE_AUTHENTICATION_GITHUB_CLIENT_ID= TOLGEE_AUTHENTICATION_GITHUB_CLIENT_SECRET= TOLGEE_AUTHENTICATION_GITHUB_USER_URL=https://api.github.com/user TOLGEE_AUTHENTICATION_GOOGLE_AUTHORIZATION_URL=https://oauth2.googleapis.com/token TOLGEE_AUTHENTICATION_GOOGLE_CLIENT_ID= TOLGEE_AUTHENTICATION_GOOGLE_CLIENT_SECRET= TOLGEE_AUTHENTICATION_GOOGLE_USER_URL=https://www.googleapis.com/oauth2/v3/userinfo TOLGEE_AUTHENTICATION_GOOGLE_WORKSPACE_DOMAIN= TOLGEE_AUTHENTICATION_OAUTH2_AUTHORIZATION_URL= TOLGEE_AUTHENTICATION_OAUTH2_CLIENT_ID= TOLGEE_AUTHENTICATION_OAUTH2_CLIENT_SECRET= TOLGEE_AUTHENTICATION_OAUTH2_SCOPES=[] TOLGEE_AUTHENTICATION_OAUTH2_TOKEN_URL= TOLGEE_AUTHENTICATION_OAUTH2_USER_URL= TOLGEE_AUTHENTICATION_SSO_GLOBAL_AUTHORIZATION_URI= TOLGEE_AUTHENTICATION_SSO_GLOBAL_CLIENT_ID= TOLGEE_AUTHENTICATION_SSO_GLOBAL_CLIENT_SECRET= TOLGEE_AUTHENTICATION_SSO_GLOBAL_CUSTOM_LOGIN_TEXT= TOLGEE_AUTHENTICATION_SSO_GLOBAL_CUSTOM_LOGO_URL= TOLGEE_AUTHENTICATION_SSO_GLOBAL_DOMAIN= TOLGEE_AUTHENTICATION_SSO_GLOBAL_ENABLED=false TOLGEE_AUTHENTICATION_SSO_GLOBAL_FORCE=false TOLGEE_AUTHENTICATION_SSO_GLOBAL_SESSION_EXPIRATION_MINUTES=10 TOLGEE_AUTHENTICATION_SSO_GLOBAL_TOKEN_URI= TOLGEE_AUTHENTICATION_SSO_ORGANIZATIONS_ALLOW_LOCAL_ADDRESSES=false TOLGEE_AUTHENTICATION_SSO_ORGANIZATIONS_ENABLED=false TOLGEE_AUTHENTICATION_SSO_ORGANIZATIONS_SESSION_EXPIRATION_MINUTES=10 TOLGEE_BATCH_CANCELLATION_TIMEOUT_MS=30000 TOLGEE_BATCH_COMPLETED_JOB_RETENTION_DAYS=3 TOLGEE_BATCH_CONCURRENCY=1 TOLGEE_BATCH_FAILED_JOB_RETENTION_DAYS=30 TOLGEE_BATCH_JOB_CLEANUP_BATCH_SIZE=1000 TOLGEE_BATCH_JOB_CLEANUP_LOCK_LEASE_TIME_MS=86400000 TOLGEE_BATCH_JOB_TYPE_OVERRIDES={} TOLGEE_BATCH_MAX_PER_MT_JOB_CONCURRENCY=-1 TOLGEE_BATCH_OLD_JOB_CLEANUP_DELAY_IN_MS=28800000 TOLGEE_BATCH_OLD_JOB_CLEANUP_ENABLED=true TOLGEE_CACHE_CAFFEINE_MAX_SIZE=-1 TOLGEE_CACHE_CLEAN_ON_STARTUP=true TOLGEE_CACHE_DEFAULT_TTL=7200000 TOLGEE_CACHE_ENABLED=false TOLGEE_CACHE_USE_REDIS=false TOLGEE_CONTENT_DELIVERY_PUBLIC_URL_PREFIX= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AWS_CLOUDFRONT_ACCESS_KEY= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AWS_CLOUDFRONT_CONTENT_ROOT= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AWS_CLOUDFRONT_DISTRIBUTION_ID= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AWS_CLOUDFRONT_SECRET_KEY= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_CLIENT_ID= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_CLIENT_SECRET= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_CONTENT_ROOT= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_ENDPOINT_NAME= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_PROFILE_NAME= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_RESOURCE_GROUP_NAME= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_SUBSCRIPTION_ID= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_AZURE_FRONT_DOOR_TENANT_ID= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_BUNNY_API_KEY= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_BUNNY_CONTENT_DELIVERY_CACHE_PURGING_TYPE=BUNNY TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_BUNNY_ENABLED=false TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_BUNNY_URL_PREFIX= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_CLOUDFLARE_API_KEY= TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_CLOUDFLARE_CONTENT_DELIVERY_CACHE_PURGING_TYPE=CLOUDFLARE TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_CLOUDFLARE_ENABLED=false TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_CLOUDFLARE_MAX_FILES_PER_REQUEST=30 TOLGEE_CONTENT_DELIVERY_CACHE_PURGING_CLOUDFLARE_ORIGINS= ``` -------------------------------- ### Full Configuration Example (YAML) Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx This is a comprehensive example of the configuration file in YAML format. It covers server port, database settings, Tolgee specific URLs, file storage, machine translation, and more. ```yaml server: port: 8080 spring: datasource: url: username: password: tolgee: back-end-url: file-storage-url: front-end-url: max-screenshots-per-key: 20 max-translation-text-length: 10000 max-upload-file-size: 51200 translations-view-languages-limit: -1 authentication: allowed-email-domains: [] block-disposable-emails: true block-email-aliases: true blocked-email-domains: [] create-demo-for-initial-user: true enabled: true initial-password: initial-username: admin jwt-expiration: 604800000 jwt-secret: jwt-super-expiration: 3600000 native-enabled: true needs-email-verification: false registrations-allowed: false secured-image-retrieval: false secured-image-timestamp-max-age: 7200000 user-can-create-organizations: true github: authorization-url: https://github.com/login/oauth/access_token client-id: client-secret: user-url: https://api.github.com/user google: authorization-url: https://oauth2.googleapis.com/token client-id: client-secret: user-url: https://www.googleapis.com/oauth2/v3/userinfo workspace-domain: oauth2: authorization-url: client-id: client-secret: scopes: [] token-url: user-url: sso-global: authorization-uri: client-id: client-secret: custom-login-text: custom-logo-url: domain: enabled: false force: false session-expiration-minutes: 10 token-uri: sso-organizations: allow-local-addresses: false enabled: false session-expiration-minutes: 10 batch: cancellation-timeout-ms: 30000 completed-job-retention-days: 3 concurrency: 1 failed-job-retention-days: 30 job-cleanup-batch-size: 1000 job-cleanup-lock-lease-time-ms: 86400000 job-type-overrides: {} max-per-mt-job-concurrency: -1 old-job-cleanup-delay-in-ms: 28800000 old-job-cleanup-enabled: true cache: caffeine-max-size: -1 clean-on-startup: true default-ttl: 7200000 enabled: false use-redis: false content-delivery: public-url-prefix: cache-purging: aws-cloudfront: access-key: content-root: distribution-id: secret-key: azure-front-door: client-id: client-secret: content-root: endpoint-name: profile-name: resource-group-name: subscription-id: tenant-id: bunny: api-key: content-delivery-cache-purging-type: BUNNY enabled: false url-prefix: cloudflare: api-key: content-delivery-cache-purging-type: CLOUDFLARE enabled: false max-files-per-request: 30 origins: url-prefix: zone-id: storage: azure: connection-string: container-name: s3: access-key: bucket-name: endpoint: path: secret-key: signing-region: file-storage: fs-data-path: ~/.tolgee/ s3: access-key: bucket-name: enabled: false endpoint: path: secret-key: signing-region: import: base-language-tag: en create-implicit-api-key: false dir: flush-batch-size: 10000 store-files-for-debugging: false language-tool: connect-timeout-seconds: 5 max-concurrent-requests: 2 read-timeout-seconds: 60 url: llm: default-enabled: true default-primary: true enabled: fallbacks: {} provider-defaults: {} providers: - api-key: api-url: attempts: deployment: enabled: true format: max-tokens: 2000 model: name: default priority: reasoning-effort: type: OPENAI machine-translation: free-credits-amount: -1 aws: access-key: default-enabled: true default-primary: false enabled: region: eu-central-1 secret-key: azure: auth-key: default-enabled: true default-primary: false region: baidu: action: false app-id: app-secret: default-enabled: true default-primary: false deepl: auth-key: default-enabled: true default-primary: false optional-parameters: google: api-key: default-enabled: true default-primary: true postgres-autostart: container-name: tolgee_postgres database-name: postgres enabled: true max-wait-time: 300 mode: DOCKER password: postgres port: 25432 stop: true user: postgres rate-limits: ``` -------------------------------- ### Full Configuration Example Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx This snippet shows a comprehensive set of configuration properties for Tolgee self-hosting. ```properties tolgee.webhook.allow-local-addresses = false tolgee.webhook.auto-disable-after-days = 3 tolgee.webhook.auto-disable-enabled = true tolgee.webhook.auto-disable-warning-after-hours = 6 tolgee.websocket.use-redis = false ``` -------------------------------- ### Example YAML Configuration Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx Provides an example of server and Spring data source settings in YAML format. Configure the server port and database connection details. ```yaml server: port: 8080 spring: datasource: url: jdbc:postgresql://db:5432/postgres username: postgres password: postgres ``` -------------------------------- ### Install Tolgee Vue Integration Library Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/vue/installation.mdx Run this command to install the Tolgee integration library for Vue. ```bash npm install @tolgee/vue # or yarn add @tolgee/vue ``` -------------------------------- ### Full Configuration Example (application.properties) Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx This snippet shows a complete set of properties for configuring a self-hosted Tolgee instance. It covers server port, database connection details, Tolgee backend and frontend URLs, file storage, and various authentication and batch processing settings. ```properties server.port = 8080 spring.datasource.url = spring.datasource.username = spring.datasource.password = tolgee.back-end-url = tolgee.file-storage-url = tolgee.front-end-url = tolgee.max-screenshots-per-key = 20 tolgee.max-translation-text-length = 10000 tolgee.max-upload-file-size = 51200 tolgee.translations-view-languages-limit = -1 tolgee.authentication.allowed-email-domains = [] tolgee.authentication.block-disposable-emails = true tolgee.authentication.block-email-aliases = true tolgee.authentication.blocked-email-domains = [] tolgee.authentication.create-demo-for-initial-user = true tolgee.authentication.enabled = true tolgee.authentication.initial-password = tolgee.authentication.initial-username = admin tolgee.authentication.jwt-expiration = 604800000 tolgee.authentication.jwt-secret = tolgee.authentication.jwt-super-expiration = 3600000 tolgee.authentication.native-enabled = true tolgee.authentication.needs-email-verification = false tolgee.authentication.registrations-allowed = false tolgee.authentication.secured-image-retrieval = false tolgee.authentication.secured-image-timestamp-max-age = 7200000 tolgee.authentication.user-can-create-organizations = true tolgee.authentication.github.authorization-url = https://github.com/login/oauth/access_token tolgee.authentication.github.client-id = tolgee.authentication.github.client-secret = tolgee.authentication.github.user-url = https://api.github.com/user tolgee.authentication.google.authorization-url = https://oauth2.googleapis.com/token tolgee.authentication.google.client-id = tolgee.authentication.google.client-secret = tolgee.authentication.google.user-url = https://www.googleapis.com/oauth2/v3/userinfo tolgee.authentication.google.workspace-domain = tolgee.authentication.oauth2.authorization-url = tolgee.authentication.oauth2.client-id = tolgee.authentication.oauth2.client-secret = tolgee.authentication.oauth2.scopes = [] tolgee.authentication.oauth2.token-url = tolgee.authentication.oauth2.user-url = tolgee.authentication.sso-global.authorization-uri = tolgee.authentication.sso-global.client-id = tolgee.authentication.sso-global.client-secret = tolgee.authentication.sso-global.custom-login-text = tolgee.authentication.sso-global.custom-logo-url = tolgee.authentication.sso-global.domain = tolgee.authentication.sso-global.enabled = false tolgee.authentication.sso-global.force = false tolgee.authentication.sso-global.session-expiration-minutes = 10 tolgee.authentication.sso-global.token-uri = tolgee.authentication.sso-organizations.allow-local-addresses = false tolgee.authentication.sso-organizations.enabled = false tolgee.authentication.sso-organizations.session-expiration-minutes = 10 tolgee.batch.cancellation-timeout-ms = 30000 tolgee.batch.completed-job-retention-days = 3 tolgee.batch.concurrency = 1 tolgee.batch.failed-job-retention-days = 30 tolgee.batch.job-cleanup-batch-size = 1000 tolgee.batch.job-cleanup-lock-lease-time-ms = 86400000 tolgee.batch.job-type-overrides = {} tolgee.batch.max-per-mt-job-concurrency = -1 tolgee.batch.old-job-cleanup-delay-in-ms = 28800000 tolgee.batch.old-job-cleanup-enabled = true tolgee.cache.caffeine-max-size = -1 tolgee.cache.clean-on-startup = true tolgee.cache.default-ttl = 7200000 tolgee.cache.enabled = false tolgee.cache.use-redis = false tolgee.content-delivery.public-url-prefix = tolgee.content-delivery.cache-purging.aws-cloudfront.access-key = tolgee.content-delivery.cache-purging.aws-cloudfront.content-root = tolgee.content-delivery.cache-purging.aws-cloudfront.distribution-id = tolgee.content-delivery.cache-purging.aws-cloudfront.secret-key = tolgee.content-delivery.cache-purging.azure-front-door.client-id = tolgee.content-delivery.cache-purging.azure-front-door.client-secret = tolgee.content-delivery.cache-purging.azure-front-door.content-root = tolgee.content-delivery.cache-purging.azure-front-door.endpoint-name = tolgee.content-delivery.cache-purging.azure-front-door.profile-name = tolgee.content-delivery.cache-purging.azure-front-door.resource-group-name = tolgee.content-delivery.cache-purging.azure-front-door.subscription-id = tolgee.content-delivery.cache-purging.azure-front-door.tenant-id = tolgee.content-delivery.cache-purging.bunny.api-key = tolgee.content-delivery.cache-purging.bunny.content-delivery-cache-purging-type = BUNNY tolgee.content-delivery.cache-purging.bunny.enabled = false tolgee.content-delivery.cache-purging.bunny.url-prefix = tolgee.content-delivery.cache-purging.cloudflare.api-key = tolgee.content-delivery.cache-purging.cloudflare.content-delivery-cache-purging-type = CLOUDFLARE tolgee.content-delivery.cache-purging.cloudflare.enabled = false ``` -------------------------------- ### Install Tolgee Angular Library Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/angular/installation.mdx Run this command to install the Tolgee integration library for Angular. ```bash npm install @tolgee/ngx # or yarn add @tolgee/ngx ``` -------------------------------- ### Run API with Node.js Source: https://github.com/tolgee/documentation/blob/main/api/run.api.mdx Example of running the Tolgee API using Node.js. Ensure you have Node.js installed and the necessary Tolgee packages. ```javascript const { Tolgee } = require('@tolgee/core'); const tolgee = new Tolgee({ // ... configuration options }); async function runApi() { // ... API call examples } runApi(); ``` -------------------------------- ### Install Tolgee i18next Integration Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/i18next/installation.mdx Use this command to install the Tolgee i18next integration library. ```bash npm install @tolgee/i18next # or yarn add @tolgee/i18next ``` -------------------------------- ### Install Packages for Next-intl and Tolgee Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/react/next/app_router_next_intl.mdx Install the necessary packages for next-intl and Tolgee integration. This includes 'next-intl', '@tolgee/react', and '@tolgee/web'. ```bash npm install next-intl @tolgee/react @tolgee/web # or yarn add next-intl @tolgee/react @tolgee/web ``` -------------------------------- ### Example .env Configuration Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx Illustrates server and Spring data source configuration using .env file format. Set the server port and database connection parameters. ```env SERVER_PORT=8080 SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/postgres SPRING_DATASOURCE_USERNAME=postgres SPRING_DATASOURCE_PASSWORD=postgres ``` -------------------------------- ### Install Tolgee React SDK Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/react/installation.mdx Execute this command in your project's terminal to install the Tolgee React integration SDK. ```bash npm install @tolgee/react # or yarn add @tolgee/react ``` -------------------------------- ### Example application.properties Configuration Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx Shows server and Spring data source configuration using application.properties format. Define the server port and database connection details. ```properties server.port=8080 spring.datasource.url=jdbc:postgresql://db:5432/postgres spring.datasource.username=postgres spring.datasource.password=postgres ``` -------------------------------- ### Configure SMTP Server for Emails Source: https://github.com/tolgee/documentation/blob/main/platform/self_hosting/configuration.mdx Configure SMTP settings for sending emails, such as password reset links and notifications. Example shows AWS SES configuration. ```properties tolgee.smtp.host=email-smtp.eu-central-1.amazonaws.com tolgee.smtp.username=***************** tolgee.smtp.password=***************** tolgee.smtp.port=465 tolgee.smtp.auth=true tolgee.smtp.ssl-enabled=true tolgee.smtp.from=Tolgee ``` -------------------------------- ### Set finished state Source: https://github.com/tolgee/documentation/blob/main/api/set-finished-state.api.mdx Sets the finished state of the quick start guide. This operation is useful for marking the quick start guide as completed or not completed. ```APIDOC ## PUT /v2/quick-start/set-finished/{finished} ### Description Sets finished state of the quick start guide ### Method PUT ### Endpoint /v2/quick-start/set-finished/{finished} ### Parameters #### Path Parameters - **finished** (boolean) - Required - Indicates whether the quick start guide is finished. ### Response #### Success Response (200) - **completedSteps** (array[string]) - List of completed steps in the quick start guide. - **finished** (boolean) - Indicates if the quick start guide is finished. - **open** (boolean) - Indicates if the quick start guide is open. #### Response Example { "completedSteps": [ "step1", "step2" ], "finished": true, "open": false } #### Error Response (400) Bad Request ``` -------------------------------- ### Complete Guide Step Source: https://github.com/tolgee/documentation/blob/main/api/complete-guide-step.api.mdx Marks a specific step in the quick start guide as completed. ```APIDOC ## PUT /v2/quick-start/steps/{step}/complete ### Description Marks guide step as completed ### Method PUT ### Endpoint /v2/quick-start/steps/{step}/complete ### Parameters #### Path Parameters - **step** (string) - Required - The identifier of the step to complete. ### Response #### Success Response (200) - **completedSteps** (array) - A list of completed step identifiers. - **finished** (boolean) - Indicates if the entire quick start guide is finished. - **open** (boolean) - Indicates if the quick start guide is currently open. ``` -------------------------------- ### Set open state Source: https://github.com/tolgee/documentation/blob/main/api/set-open-state.api.mdx Sets the open state of the quick start guide. ```APIDOC ## PUT /v2/quick-start/set-open/{open} ### Description Sets open state of the quick start guide ### Method PUT ### Endpoint /v2/quick-start/set-open/{open} ### Parameters #### Path Parameters - **open** (boolean) - Required - Determines if the quick start guide should be open or closed. #### Request Body This endpoint does not accept a request body. ### Response #### Success Response (200) - **completedSteps** (array) - List of completed steps in the quick start guide. - **finished** (boolean) - Indicates if the quick start guide is finished. - **open** (boolean) - The current open state of the quick start guide. #### Response Example ```json { "completedSteps": [ "step1", "step2" ], "finished": false, "open": true } ``` ``` -------------------------------- ### Tolgee Setup File Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/react/next/pages_router.mdx Initialize Tolgee with necessary plugins, languages, API credentials, and static data loading configuration. ```typescript import { FormatIcu } from '@tolgee/format-icu'; import { Tolgee, DevTools } from '@tolgee/react'; export const tolgee = Tolgee() .use(FormatIcu()) .use(DevTools()) .init({ availableLanguages: ['en', 'cs'], defaultLanguage: 'en', apiKey: process.env.NEXT_PUBLIC_TOLGEE_API_KEY, apiUrl: process.env.NEXT_PUBLIC_TOLGEE_API_URL, staticData: { en: () => import('../messages/en.json'), cs: () => import('../messages/cs.json'), } }); ``` -------------------------------- ### Vue 2 Setup with i18next and Tolgee Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/i18next/vue_integration.mdx Configure your i18next instance with Tolgee and Vue integration. Ensure you have installed `@panter/vue-i18next` and `i18next-icu`. This setup uses the ICU message formatter. ```typescript import {withTolgee, I18nextPlugin, DevTools} from '@tolgee/i18next'; import i18next from 'i18next'; import ICU from 'i18next-icu'; import VueI18Next from '@panter/vue-i18next'; Vue.use(VueI18Next); const tolgee = Tolgee().use(DevTools()).use(I18nextPlugin()).init({ apiUrl: process.env.VUE_APP_TOLGEE_API_URL, apiKey: process.env.VUE_APP_TOLGEE_API_KEY, }); withTolgee(i18next, tolgee) .use(ICU) .init({ lng: 'en', // or use i18next language detector supportedLngs: ['cs', 'en', 'fr', 'de'], }); const i18n = new VueI18Next(i18next); new Vue({ i18n, ... }).$mount('#app'); ``` -------------------------------- ### Svelte Language Switching Example Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/svelte/switching_language.mdx Use the `getTolgee` function to get the Tolgee instance and subscribe to language changes. This example shows how to bind a select element to change the application's language. ```svelte ``` -------------------------------- ### Initialize Tolgee with Plugins Source: https://github.com/tolgee/documentation/blob/main/js-sdk/api/web_package/plugins.mdx Demonstrates the basic structure for initializing Tolgee and applying plugins using the `use` method. ```typescript const tolgee = Tolgee() .use(...) .updateDefaults(...) .init(...) ``` -------------------------------- ### Vue Language Switching Example Source: https://github.com/tolgee/documentation/blob/main/js-sdk/integrations/vue/switching_languages.mdx Use the `useTolgee` composable to get the Tolgee instance and subscribe to language changes. This example shows how to bind a select element to the current language and update it when the user makes a selection. ```html ``` -------------------------------- ### Create Project Source: https://github.com/tolgee/documentation/blob/main/api/get-issues.api.mdx Initializes a new project within the Tolgee platform. ```javascript fetch('https://api.tolgee.io/v2/projects', { method: 'POST', headers: { Authorization: `API_KEY ${apiKey}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'My New Project', }), }).then((res) => res.json()) ``` -------------------------------- ### Get all prompts (paginated) Source: https://github.com/tolgee/documentation/blob/main/api/get-all-paged.api.mdx Retrieves a paginated list of all prompts. This endpoint allows you to fetch prompts with control over the number of results per page and the starting offset. ```APIDOC ## GET /v2/projects/{projectId}/prompts ### Description Retrieves a paginated list of all prompts. ### Method GET ### Endpoint `/v2/projects/{projectId}/prompts` ### Parameters #### Query Parameters - **size** (integer) - Optional - The number of prompts to return per page. Defaults to 20. - **page** (integer) - Optional - The page number to retrieve. Defaults to 0. ### Response #### Success Response (200) - **content** (array) - A list of prompt objects. - **id** (integer) - The unique identifier of the prompt. - **name** (string) - The name of the prompt. - **text** (string) - The text content of the prompt. - **description** (string) - A description of the prompt. - **createdAt** (string) - The timestamp when the prompt was created. - **updatedAt** (string) - The timestamp when the prompt was last updated. - **pageable** (object) - **pageNumber** (integer) - The current page number. - **pageSize** (integer) - The number of items per page. - **offset** (integer) - The offset from the start of the results. - **paged** (boolean) - Indicates if the response is paged. - **unpaged** (boolean) - Indicates if the response is unpaged. - **totalPages** (integer) - The total number of pages available. - **totalElements** (integer) - The total number of elements across all pages. - **last** (boolean) - Indicates if this is the last page. - **first** (boolean) - Indicates if this is the first page. - **sort** (object) - **empty** (boolean) - Indicates if the sort is empty. - **sorted** (boolean) - Indicates if the sort is applied. - **unsorted** (boolean) - Indicates if the sort is not applied. - **numberOfElements** (integer) - The number of elements on the current page. - **empty** (boolean) - Indicates if the current page is empty. #### Response Example ```json { "content": [ { "id": 1, "name": "Welcome message", "text": "Hello, welcome to our service!", "description": "Initial greeting for new users.", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ], "pageable": { "pageNumber": 0, "pageSize": 20, "offset": 0, "paged": true, "unpaged": false }, "totalPages": 5, "totalElements": 100, "last": false, "first": true, "sort": { "empty": false, "sorted": true, "unsorted": false }, "numberOfElements": 20, "empty": false } ``` ```