From Fedora Project Wiki

No edit summary
No edit summary
Line 26: Line 26:
<pre>
<pre>
yum groupinstall  hindi-support
yum groupinstall  hindi-support
</pre>
== Hello World==
<pre>
#include<stdio.h>
int main()
{
    printf("Hello World");
    return 0;
}
</pre>
== Hello World Internationalized using gettext==
<pre>
#include<libintl.h>
#include<locale.h>
#include<stdio.h>
#define _(String) gettext (String)
#define _t(String1,String2,n) ngettext (String1,String2,n)
int main()
{
    setlocale(LC_ALL,"");
    bindtextdomain("helloworld","/usr/share/locale");
    textdomain("helloworld");
    printf(_("Hello World"));
    return 0;
}
</pre>
</pre>
.....editing on-----
.....editing on-----

Revision as of 11:04, 27 April 2010

Author: Naveen Kumar

Internationalization (i18n) refers to an application's/package's support for multiple languages. This support comes from a kind of generalization on part of application/package that helps Localize it in different languages.

Localization or (l10n) here refers to the process of adapting, translating or customising that application/package for a particular locale.

Locale is a term used to define a set of information corresponding to a given language & country. A locale information is used by a software application (or operating system) to exhibit a localised behaviour. This localised behaviour is in the form of displaying Application's/package's text in local language or other things pertaining to a locale convention such as localized date, currency format, color conventions, etc.

In this tutorial we will cover i18n & l10n only with respect to text i18n/l10n.

Gettext framework is one such approach to do text i18n. It refers to a collection of tools which are used to internationalize and localize an application/package. Apart from internationalization of applications/packages these tools assist in translating the strings on menus, messages boxes or icons on the applications in the language that the user is interested in.

For a detailed information on text internationalization you can refer to Gettext manual

Development Environment

To internationalize an application we need a set of development tools. This is a one-time-only setup, installed by running those commands from a system administration (root) account:

yum install  @development-tools
yum groupinstall  <langname>-support

The <langname> above refers to the name of your language. For hindi I would write something like:

yum groupinstall  hindi-support

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}


Hello World Internationalized using gettext

#include<libintl.h>
#include<locale.h>
#include<stdio.h>

#define _(String) gettext (String)
#define _t(String1,String2,n) ngettext (String1,String2,n)

int main()
{
    setlocale(LC_ALL,"");
    bindtextdomain("helloworld","/usr/share/locale");
    textdomain("helloworld");
    printf(_("Hello World"));
    return 0;
}

.....editing on-----