L-ewwel passi
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, tgħatti 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 ssettjat biex juża l-Ispanjol (locale="es"), għalhekk il-komponent Translate se juri "¡Hola, mundo!".
Eżempji
Mur lejn il-folder tal-eżempji tagħna fuq GitHub biex titgħallem aktar dwar kif issettja TacoTranslate speċifikament għall-każ tiegħek, bħal ma Next.js App Router, jew billi tuża Create React App.
Għandna wkoll CodeSandbox imwaqqaf li tista' taċċessa hawn.