ਸ਼ੁਰੂਆਤ
ਇੰਸਟਾਲੇਸ਼ਨ
To install TacoTranslate in your application, open your terminal and navigate to the root directory of your project. Then, run the following command to install with npm:
npm install tacotranslateThis assumes you already have an application set up. See examples for more information.
ਬੁਨਿਆਦੀ ਵਰਤੋਂ
ਹੇਠਾਂ ਦਿੱਤੀ ਉਦਾਹਰਨ ਦਰਸਾਉਂਦੀ ਹੈ ਕਿ ਕਿਵੇਂ ਇੱਕ TacoTranslate ਕਲਾਇੰਟ ਬਣਾਇਆ ਜਾਵੇ, ਆਪਣੇ ਐਪਲੀਕੇਸ਼ਨ ਨੂੰ TacoTranslate ਪ੍ਰੋਵਾਈਡਰ ਨਾਲ ਰੈਪ ਕੀਤਾ ਜਾਵੇ, ਅਤੇ ਅਨੁਵਾਦਿਤ ਸਤਰਾਂ ਦਿਖਾਉਣ ਲਈ Translate ਕੰਪੋਨੈਂਟ ਦੀ ਵਰਤੋਂ ਕੀਤੀ ਜਾਵੇ।
import createTacoTranslateClient from 'tacotranslate';
import {TacoTranslate, Translate} from 'tacotranslate/react';
const tacoTranslateClient = createTacoTranslateClient({apiKey: 'YOUR_API_KEY'});
function Page() {
return <Translate string="Hello, world!" />;
}
export default function App() {
return (
<TacoTranslate client={tacoTranslateClient} locale="es">
<Page />
</TacoTranslate>
);
}ਇਹ ਉਦਾਹਰਨ ਸਪੇਨੀ (locale="es") ਵਰਤਣ ਲਈ ਸੈੱਟ ਕੀਤੀ ਗਈ ਹੈ, ਇਸ ਲਈ Translate ਕੰਪੋਨੈਂਟ "¡Hola, mundo!" ਪ੍ਰਦਰਸ਼ਿਤ ਕਰੇਗਾ।
ਉਦਾਹਰਨਾਂ
ਹੋਰ ਜਾਣਨ ਲਈ, ਸਾਡੇ GitHub ਉਦਾਹਰਣ ਫੋਲਡਰ ਤੱਕ ਜਾਓ ਅਤੇ ਜਾਣੋ ਕਿ ਆਪਣੇ ਵਰਤੋਂਕੇਸ ਲਈ TacoTranslate ਨੂੰ ਕਿਵੇਂ ਸੈਟਅਪ ਕਰਨਾ ਹੈ, ਉਦਾਹਰਣ ਵਜੋਂ Next.js App Router ਨਾਲ ਜਾਂ Create React App ਦੀ ਵਰਤੋਂ ਕਰਕੇ।
ਅਸੀਂ ਇੱਕ CodeSandbox ਵੀ ਤਿਆਰ ਕੀਤਾ ਹੈ, ਜਿਸਨੂੰ ਤੁਸੀਂ ਇੱਥੇ ਵੇਖ ਸਕਦੇ ਹੋ।