TacoTranslate
/
ஆவணங்கள்விலைகள்
 
  1. அறிமுகம்
  2. தொடக்கம்
  3. அமைப்பு மற்றும் கட்டமைப்பு
  4. TacoTranslate-ஐ பயன்படுத்துதல்
  5. சர்வர்-பக்க ரெண்டரிங்
  6. மேம்பட்ட பயன்பாடுகள்
  7. சிறந்த நடைமுறைகள்
  8. பிழை கையாளுதல் மற்றும் பிழைதிருத்தம்
  9. ஆதரிக்கப்படும் மொழிகள்

சிறந்த நடைமுறைகள்

URL-களை மாறிகளில் வைக்கவும்

URL-கள் அல்லது அதுபோன்ற தரவுகள் கொண்ட ஸ்ட்ரிங்களை மொழிபெயரிக்கும்போது, அந்த URL-களை மாறிலிகளில் வைக்கி பின்னர் உங்கள் டெம்ப்ளேட்டுகளில் அவைகளை குறிப்பிடுவது ஒரு நல்ல நடைமுறை எனக் கருதப்படுகிறது.

<Translate
	string={`Click <a href="{{url}}">here</a>`}
	variables={{url: 'https://tacotranslate.com'}}
/>

ARIA லேபல்களைப் பயன்படுத்தவும்

பட்டன்கள் போன்ற தொடர்பு உள்ள கூறுகளின் உரையை மொழிபெயர்க்கும்போது, அணுகல்திறனை உறுதிசெய்ய ARIA லேபிள்களைச் சேர்ப்பது முக்கியம். ARIA லேபிள்கள் ஸ்கிரீன் ரீடர்களுக்கு அந்த கூறின் செயல்பாடு பற்றிய விளக்கமான தகவலை வழங்க உதவுகின்றன.

உதாரணமாக, கோடு பிளாக்கில் உள்ள உரையை பயனர்கள் நகலெடுக்க முடியும் என்பதைக் குறிக்கும் ஒரு பட்டன் இருந்தால், தெளிவான விளக்கத்திற்காக aria-label பண்பைப் பயன்படுத்தலாம்:

<Translate
	aria-label={useTranslation('Copy to clipboard')}
	string="Copy"
/>

இதில் ஏதோ ஒன்று மிகவும் மெட்டா போன்று உணரப்படுகிறது.

உலகளாவிய மூலங்களின் அணி மற்றும் பல கூறு மூலங்கள்

இந்த விதம் Next.js Pages Router பயன்படுத்தும்போது மட்டுமே வேலை செய்கிறது.

பெரிய பயன்பாடுகளுடன் வேலை செய்யும்போது, தொடர்கள் மற்றும் மொழிபெயர்ப்புகளை பல சிறிய மூலங்களாக பிரிப்பது பயனுள்ளதாகும். இந்த அணுகுமுறை பண்டில் அளவுகளை மற்றும் பரிமாற்ற நேரத்தை குறைக்க உதவுகிறது, மேலும் திறம்படவும் விருத்தி ஏற்றதும் உள்ளூர்வாய்ப்பு (localization) முறைமையை உறுதி செய்கிறது.

இது கிளையன்ட் பக்கத்தில் மட்டுமே ரெண்டரிங் செய்யும்போது நேரடியாகச் செய்யக்கூடியதாக இருந்தாலும், சர்வர்-சைடு ரெண்டரிங்கிற்கு மொழிபெயர்ப்புகளை அறியும்போது மூலங்களை நிர்வகிப்பது விரைவில் சிக்கலானதாகிவிடும். ஆனால், TacoTranslate கிளையன்ட் origins வரிசையை பயன்படுத்தி மூல நிர்வாகத்தை தானாகச் செய்யலாம்.

எங்கள் கூறுகள் மற்றும் பக்கங்களை தனித்தனியான கோப்புகளாக பிரித்துள்ள இதைப் போன்ற எடுத்துக்காட்டைக் கவனிக்கவும்.

components/pricing-table.tsx
import TacoTranslate, {Translate} from 'tacotranslate/react';
import tacoTranslate from '../tacotranslate-client';

// Set an origin name for this component
const origin = 'components/pricing-table';

// Push the origin into the origins array as this file is imported
tacoTranslate.origins.push(origin);

export default function PricingTable() {
	return (
		<TacoTranslate origin={origin}>
			<Translate string="Pricing table" />
			// ...
		</TacoTranslate>
	);
}
pages/pricing.tsx
import TacoTranslate, {Translate} from 'tacotranslate/react';
import getTacoTranslateStaticProps from 'tacotranslate/next/get-static-props';
import tacoTranslateClient from '../tacotranslate-client';
import PricingTable from '../components/pricing-table';

const origin = 'pages/pricing';
tacoTranslateClient.origins.push(origin);

export default function PricingPage() {
	return (
		<TacoTranslate origin={origin}>
			<Translate string="Pricing page" />
			<PricingTable />
		</TacoTranslate>
	);
}

// We will now fetch translations for all imported components and their origins automatically
export async function getStaticProps(context) {
	return getTacoTranslateStaticProps(context, {client: tacoTranslateClient});
}

getTacoTranslateStaticProps பற்றி மேலும் தகவலுக்காக எங்கள் சர்வர்-சைடு ரெண்டரிங் உதாரணங்கள் ஐப் பார்க்கவும்.

பிழை கையாளுதல் மற்றும் பிழைதிருத்தம்

Nattskiftet வழங்கும் ஒரு தயாரிப்புநார்வோவில் தயாரிக்கப்பட்டது