குனு கெட்டடெக்ச்ட் பயன்படுத்தி மென்பொருளை மொழிபெயர்த்தல்¶
GNU gettext is one of the most widely used tool for internationalization of free software. It provides a simple yet flexible way to localize the software. It has great support for plurals, it can add further context to the translated string and there are quite a lot of tools built around it. Of course it has great support in Weblate (see குனு கெட்டெக்ச்ட் போ (சிறிய பொருள்) file format description).
Note
நீங்கள் அதை தனியுரிம மென்பொருளில் பயன்படுத்தப் போகிறீர்கள் என்றால், முதலில் உரிமத்தை அணுகவும், இது உங்களுக்கு ஏற்றதாக இருக்காது.
குனு கெட்டடெக்ச்ட் பல்வேறு மொழிகளிலிருந்து (சி, பைத்தான், பிஎச்பி, ரூபி, சாவாச்கிரிப்ட் மற்றும் பல) பயன்படுத்தப்படலாம், மேலும் பொதுவாக யுஐ கட்டமைப்புகள் ஏற்கனவே அதற்கு சில ஆதரவுடன் வருகின்றன. நிலையான பயன்பாடு 'கெட்டடெக்ச்ட் ()' செயல்பாட்டு அழைப்பு வழியாகும், இது பெரும்பாலும் குறியீட்டை எளிமையாகவும் படிக்க எளிதாகவும் மாற்ற '_()' என்று மறுபெயரிடப்படுகிறது.
கூடுதலாக இது மொழிபெயர்ப்பாளர்களுக்கு கூடுதல் சூழலை வழங்க 'பிகெட்டெக்ச்ட் ()' அழைப்பையும், இலக்கு மொழிக்கு வரையறுக்கப்பட்ட பன்மை வகைகளைக் கையாளக்கூடிய 'என்கெட்டெக்ச்ட் ()' அழைப்பையும் வழங்குகிறது.
As a widely spread tool, it has many wrappers which make its usage really simple, instead of manual invoking of gettext described below, you might want to try one of them, for example intltool.
பணிப்பாய்வு கண்ணோட்டம்¶
உள்ளூர்மயமாக்கலை நிர்வகிக்க குனு பல கோப்புகளைப் பயன்படுத்துகிறது:
PACKAGE.potcontains strings extracted from your source code, typically using xgettext or some high level wrappers such as intltool.LANGUAGE.pocontains strings with a translation to single language. It has to be updated by msgmerge once thePACKAGE.potis updated. You can create new language files using msginit or within Weblate.LANGUAGE.mocontains binary representation ofLANGUAGE.poand is used at application runtime. Typically it is not kept under version control, but generated at compilation time using msgfmt. In case you want to have it in the version control, you can generate it in Weblate using mo கோப்புகளை உருவாக்குங்கள் add-on.
மொத்தத்தில் குனு கெட்டெக்ச்ட் பணிப்பாய்வு இப்படி இருக்கும்:
See also
மாதிரி நிரல்¶
கெட்டடெக்ச்டைப் பயன்படுத்தி சி இல் உள்ள எளிய நிரல் பின்வருமாறு தோன்றலாம்:
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int count = 1;
setlocale(LC_ALL, "");
bindtextdomain("hello", "/usr/share/locale");
textdomain("hello");
printf(
ngettext(
"Orangutan has %d banana.\n",
"Orangutan has %d bananas.\n",
count
),
count
);
printf("%s\n", gettext("Thank you for using Weblate."));
exit(0);
}
மொழிபெயர்க்கக்கூடிய சரங்களை பிரித்தெடுத்தல்¶
Once you have code using the gettext calls, you can use xgettext to extract messages from it and store them into a .pot:
$ xgettext main.c -o po/hello.pot
Note
There are alternative programs to extract strings from the code, for example pybabel.
This creates a template file, which you can use for starting new translations (using msginit) or updating existing ones after code change (you would use msgmerge for that). The resulting file is simply a structured text file:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-23 11:02+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: main.c:14
#, c-format
msgid "Orangutan has %d banana.\n"
msgid_plural "Orangutan has %d bananas.\n"
msgstr[0] ""
msgstr[1] ""
#: main.c:20
msgid "Thank you for using Weblate."
msgstr ""
ஒவ்வொரு 'msgid' வரியும் மொழிபெயர்க்க ஒரு சரத்தை வரையறுக்கிறது, தொடக்கத்தில் உள்ள சிறப்பு வெற்று சரம் மொழிபெயர்ப்பைப் பற்றிய மேனிலை தரவு கொண்ட கோப்பு தலைப்பு ஆகும்.
புதிய மொழிபெயர்ப்பைத் தொடங்குதல்¶
வார்ப்புருவுடன், எங்கள் முதல் மொழிபெயர்ப்பைத் தொடங்கலாம்:
$ msginit -i po/hello.pot -l cs --no-translator -o po/cs.po
Created cs.po.
The just created cs.po already has some information filled in. Most
importantly it got the proper plural forms definition for chosen language and you
can see number of plurals have changed according to that:
# Czech translations for PACKAGE package.
# Copyright (C) 2015 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Automatically generated, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-23 11:02+0200\n"
"PO-Revision-Date: 2015-10-23 11:02+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: main.c:14
#, c-format
msgid "Orangutan has %d banana.\n"
msgid_plural "Orangutan has %d bananas.\n"
msgstr[0] ""
msgstr[1] ""
msgstr[2] ""
#: main.c:20
msgid "Thank you for using Weblate."
msgstr ""
This file is compiled into an optimized binary form, the .mo file used by the GNU gettext functions at runtime.
புதுப்பித்தல் சரங்கள்¶
Once you add more strings or change some strings in your program, you execute again xgettext which regenerates the template file:
$ xgettext main.c -o po/hello.pot
பின்னர் புதிதாக உருவாக்கப்பட்ட வார்ப்புருக்களுடன் பொருந்த தனிப்பட்ட மொழிபெயர்ப்பு கோப்புகளைப் புதுப்பிக்கலாம் (புதிய வார்ப்புருவுடன் பொருந்துவதற்கு சரங்களை மீண்டும் ஒழுங்கமைப்பது இதில் அடங்கும்):
$ msgmerge --previous --update po/cs.po po/hello.pot
வலைபெயர்ப்பு க்கு இறக்குமதி செய்தல்¶
To import such translation into Weblate, all you need to define are the following fields when creating component (see கூறு உள்ளமைவு for detailed description of the fields):
வயல் |
மதிப்பு |
|---|---|
மூல குறியீடு களஞ்சியம் |
உங்கள் திட்டத்துடன் vcs களஞ்சியத்தின் முகவரி |
கோப்பு முகமூடி |
|
புதிய மொழிபெயர்ப்புகளுக்கான வார்ப்புரு |
|
கோப்பு வகை |
Choose gettext PO file |
புதிய மொழி |
Choose Create new language file |
அவ்வளவுதான், நீங்கள் இப்போது உங்கள் மென்பொருளை மொழிபெயர்க்கத் தொடங்கத் தயாராக உள்ளீர்கள்!
See also
கிட்அப்பில் உள்ள வலைபெயர்ப்பு அலோ திட்டத்தில் பல மொழிகளுடன் ஒரு கெட்டடெக்ச்ட் எடுத்துக்காட்டைக் காணலாம்: <https://github.com/weblateorg/hello>.