История изменений
Исправление
YanGus,
(текущая версия)
:
hello.c
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
int main()
{
/* Setting the i18n environment */
setlocale (LC_ALL, "");
bindtextdomain ("hello", getenv("PWD"));
textdomain ("hello");
/* Example of i18n usage */
printf(_("Hello World\n"));
return EXIT_SUCCESS;
}
# Russian translations for Hello package.
# Copyright (C) 2017 THE Hello'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Hello package.
# Yan Gus <xxxxxxgmail.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Hello 1.0\n"
"Report-Msgid-Bugs-To: xxxxxx@gmail.com\n"
"POT-Creation-Date: 2017-06-26 16:35+0300\n"
"PO-Revision-Date: 2017-06-26 16:36+0300\n"
"Last-Translator: Yan Gus <xxxxxx@gmail.com>\n"
"Language-Team: Russian\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. Example of i18n usage
#: hello.c:17
#, c-format
msgid "Hello World\n"
msgstr "Привет Мир\n"
Файл hello.mo в /usr/share/locale/ru/LC_MESSAGES/. Права доступа в норме.
Компиляция
gcc hello.c --std=c89 -o hello -W -Wall -Wextra -pedantic
LANG=ru_RU.UTF8 ./hello
~$ echo $LANG
ru_RU.utf8
Файловая структура такая же, только без makefile.
Исходная версия Deleted, :
hello.c
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
int main()
{
/* Setting the i18n environment */
setlocale (LC_ALL, "");
bindtextdomain ("hello", getenv("PWD"));
textdomain ("hello");
/* Example of i18n usage */
printf(_("Hello World\n"));
return EXIT_SUCCESS;
}
# Russian translations for Hello package.
# Copyright (C) 2017 THE Hello'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Hello package.
# Yan Gus <xxxxxxgmail.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Hello 1.0\n"
"Report-Msgid-Bugs-To: xxxxxx@gmail.com\n"
"POT-Creation-Date: 2017-06-26 16:35+0300\n"
"PO-Revision-Date: 2017-06-26 16:36+0300\n"
"Last-Translator: Yan Gus <xxxxxx@gmail.com>\n"
"Language-Team: Russian\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. Example of i18n usage
#: hello.c:17
#, c-format
msgid "Hello World\n"
msgstr "Привет Мир\n"
Файл hello.mo в /usr/share/locale/ru/LC_MESSAGES/. Права доступа в норме.
Компиляция
gcc hello.c --std=c89 -o hello -W -Wall -Wextra -pedantic
LANG=ru_RU.UTF8 ./hello
~$ echo $LANG
ru_RU.utf8