TacoTranslate
/
ഡോക്യുമെന്റേഷൻവിലനിര്‍ണ്ണയം
 
  1. ആമുഖം
  2. ആരംഭിക്കുന്നത്
  3. സജ്ജീകരണവും കോൺഫിഗറേഷനും
  4. TacoTranslate ഉപയോഗിക്കുന്നത്
  5. സെർവർ-സൈഡ് റെൻഡറിങ്
  6. ആധുനിക ഉപയോഗം
  7. ശ്രേഷ്ഠ പ്രവർത്തന രീതികൾ
  8. പിശകുകൾ കൈകാര്യംചെയ്യലും ഡിബഗിംഗും
  9. ആധാരമാക്കിയ ഭാഷകൾ

ശ്രേഷ്ഠ പ്രവർത്തന രീതികൾ

URL-കൾ വേരിയബിളുകളിൽ വിന്യാസപ്പെടുത്തുക

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 ഉപയോഗിക്കുമ്പോഴായി മാത്രമേ പ്രവർത്തിക്കൂ.

വലുതായ അപ്ലിക്കേഷനുകളിൽ ജോലി ചെയ്യുമ്പോൾ, സ്ട്രിംഗുകളും പരിഭാഷകളും നിരവധി ചെറുകിട ഉറവിടങ്ങളായി വിഭജിക്കുന്നത് ഗുണകരമാണ്. ഈ സമീപനം ബUNDLE വലിപ്പങ്ങളും ട്രാൻസ്ഫർ സമയവും കുറയ്ക്കാൻ സഹായിക്കുന്നതിനാൽ കാര്യക്ഷമവും സ്കാലബിൾ ആയ ലൊക്കലൈസേഷൻ ഉറപ്പാക്കുന്നു.

ക്ലയന്റ് സൈഡിൽ മാത്രമായുള്ള റെൻഡറിങ്ങിൽ ഇത് നേരിട്ടുള്ള എങ്കിലും, സെർവർ-സൈഡ് റെൻഡറിംഗിന് വേണ്ടി പരിഭാഷകൾ എടുക്കുമ്പോൾ ഉറവിടങ്ങൾ മാനേജുചെയ്യുന്നത് വേഗത്തിൽ സങ്കീർണമായി മാറുന്നു. എന്നിരുന്നാലും, 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 ൽ നിന്നുള്ള ഒരു ഉൽപ്പന്നംനോർവെയിൽ നിർമ്മിച്ചത്