Kif tibda
Installazzjoni
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.
Użu bażiku
L-eżempju hawn taħt juri kif toħloq klient ta' TacoTranslate, tavvolgi l-applikazzjoni tiegħek bil-provider TacoTranslate, u tuża l-komponent Translate biex turi testi tradotti.
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>
);
}L-eżempju huwa stabbilit biex juża l-Ispanjol (locale="es"), għalhekk il-komponent Translate se juri "¡Hola, mundo!".
Eżempji
Żur il-folder tal-eżempji tagħna fuq GitHub biex titgħallem aktar dwar kif tissettja TacoTranslate speċifikament għall-każ ta' użu tiegħek, bħal ma' Next.js App Router, jew billi tuża Create React App.
Għandna wkoll CodeSandbox issettjat li tista' tiċċekkja hawn.