शुरू करना
स्थापना
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 भी सेट किया है जिसे आप यहाँ देख सकते हैं.