શરૂઆત
સ્થાપન
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 પણ સેટ કર્યું છે જેને તમે અહીં જોઈ શકો છો.