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 பயன்படுத்துகையில் மட்டுமே செயல்படுகிறது.

பெரிய பயன்பாடுகளுடன் பணியாற்றும்போது, உரைச் கூறுகளையும் மொழிபெயர்ப்புகளையும் பல சிறிய ஆரிஜின்களாகப் பிரிப்பது பயனுள்ளதாக இருக்கும்.

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

இது கிளையன்ட் பக்கத்தில் மட்டுமே ரெண்டர் செய்யும் போது எளிதாக இருப்பினும், சர்வர்-சைடு ரெண்டரிங்குக்காக மொழிபெயர்ப்புகளை எடுக்கும் போது ஆரிஜின்களை நிர்வகிப்பது விரைவாக சிக்கலாக மாறும். ஆனால், நீங்கள் 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 வழங்கும் ஒரு தயாரிப்புநார்வேயில் தயாரிக்கப்பட்டது