TacoTranslate
/
ਦਸਤਾਵੇਜ਼ਕੀਮਤਾਂ
 
  1. ਰੂਪਰੇਖਾ
  2. ਸ਼ੁਰੂਆਤ ਕਰਨਾ
  3. ਸੈੱਟਅਪ ਅਤੇ ਸੰਰਚਨਾ
  4. TacoTranslate ਦਾ ਉਪਯੋਗ ਕਰਨਾ
  5. ਸਰਵਰ-ਸਾਈਡ ਰੇਂਡਰਿੰਗ
  6. ਉੱਨਤ ਵਰਤੋਂ
  7. ਸਰਵੋੱਤਮ ਅਭਿਆਸ
  8. ਐਰਰ ਹੈਂਡਲਿੰਗ ਅਤੇ ਡੀਬੱਗਿੰਗ
  9. ਸਮਰਥਿਤ ਭਾਸ਼ਾਵਾਂ

ਸਰਵੋੱਤਮ ਅਭਿਆਸ

URLs ਨੂੰ ਵੈਰੀਏਬਲ ਵਿੱਚ ਰੱਖੋ

ਜਦੋਂ URLs ਜਾਂ ਇਸੇ ਤਰ੍ਹਾਂ ਦੇ ਡਾਟਾ ਵਾਲੀਆਂ ਸਟਰਿੰਗਜ਼ ਦਾ ਅਨੁਵਾਦ ਕੀਤਾ ਜਾਂਦਾ ਹੈ, ਤਾਂ ਇਹ ਇਕ ਵਧੀਆ ਅਮਲ ਮੰਨਿਆ ਜਾਂਦਾ ਹੈ ਕਿ ਇਹ URLs ਵੈਰੀਏਬਲਾਂ ਦੇ ਅੰਦਰ ਰੱਖੇ ਜਾਣ ਅਤੇ ਫਿਰ ਉਨ੍ਹਾਂ ਨੂੰ ਆਪਣੇ ਟੈਂਪਲੇਟਾਂ ਵਿੱਚ ਰਿਫਰੈਂਸ ਕੀਤਾ ਜਾਵੇ।

<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 ਵਰਤਣ ਵੇਲੇ ਕੰਮ ਕਰਦਾ ਹੈ।

ਜਦੋਂ ਵੱਡੇ ਐਪਲੀਕੇਸ਼ਨਾਂ ਨਾਲ ਕੰਮ ਕੀਤਾ ਜਾਂਦਾ ਹੈ, ਤਾਂ ਸਤਰਾਂ ਅਤੇ ਅਨੁਵਾਦਾਂ ਨੂੰ ਕਈ ਛੋਟੇ-ਛੋਟੇ ਮੂਲਾਂ ਵਿੱਚ ਵੰਡਣਾ ਲਾਭਕਾਰੀ ਹੁੰਦਾ ਹੈ। ਇਹ ਤਰੀਕਾ ਬੰਡਲ ਦੇ ਆਕਾਰ ਅਤੇ ਟ੍ਰਾਂਸਫਰ ਸਮਿਆਂ ਨੂੰ ਘਟਾਉਂਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਪ੍ਰਭਾਵਸ਼ਾਲੀ ਅਤੇ ਵਿਆਪਕ ਲੋਕਲਾਈਜੇਸ਼ਨ ਯਕੀਨੀ ਬਣਦੀ ਹੈ।

ਜਦੋਂ ਇਹ ਸਿਰਫ਼ ਕਲਾਇੰਟ ਸਾਈਡ 'ਤੇ ਰੈਂਡਰਿੰਗ ਕਰਨ ਵੇਲੇ ਸਿਧਾ ਹੁੰਦਾ ਹੈ, ਤਾਂ ਸਰਵਰ-ਸਾਈਡ ਰੈਂਡਰਿੰਗ ਲਈ ਅਨੁਵਾਦ ਲੈਣ ਦੌਰਾਨ ਮੂਲਾਂ ਦਾ ਪ੍ਰਬੰਧਨ ਜਲਦੀ ਹੀ ਜਟਿਲ ਹੋ ਜਾਂਦਾ ਹੈ। ਹਾਲਾਂਕਿ, ਤੁਸੀਂ 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 ਤੋਂਨਾਰਵੇ ਵਿੱਚ ਬਣਾਇਆ ਗਿਆ