forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request conan-io#2 from jgsogo/gettext/library
gettext/library
- Loading branch information
Showing
10 changed files
with
140 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(gettext) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} gettext::gettext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
from conans import ConanFile | ||
import os | ||
import shutil | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch" | ||
generators = "txt" | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
for locale in ["en", "ru", "es"]: | ||
directory = os.path.join(self.source_folder, locale, "LC_MESSAGES") | ||
if not os.path.isdir(directory): | ||
os.makedirs(directory) | ||
shutil.copy(os.path.join(self.source_folder, "po", locale, "conan.mo.workaround_git_ignore"), | ||
os.path.join(self.source_folder, locale, "LC_MESSAGES", "conan.mo")) | ||
|
||
def test(self): | ||
for exe in ['gettext', 'ngettext', 'msgcat', 'msgmerge']: | ||
self.run("%s --version" % exe, run_environment=True) | ||
if not tools.cross_building(self.settings): | ||
self.output.info("Check working executables") | ||
for exe in ['gettext', 'ngettext', 'msgcat', 'msgmerge']: | ||
self.run("%s --version" % exe, run_environment=True) | ||
|
||
self.output.info("Check working library") | ||
bin_path = os.path.join("bin", "test_package") | ||
for locale in ["en_US", "ru_RU", "es_ES"]: | ||
with tools.environment_append({"LANG": locale}): | ||
self.run("%s %s" % (bin_path, os.path.abspath(self.source_folder)), run_environment=True) |
Binary file added
BIN
+460 Bytes
recipes/gettext/all/test_package/po/en/conan.mo.workaround_git_ignore
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Conan 1.0. | ||
# Copyright (C) Bincrafters | ||
# This file is distributed under the same license as the Conan package. | ||
# Bincrafters <bincrafters@gmail.com>, 2019. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: conan 1.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-07-11 03:48-0700\n" | ||
"PO-Revision-Date: 2019-07-11 03:57-0700\n" | ||
"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 <sse4@desktop-hhn0eap>\n" | ||
"Language-Team: English\n" | ||
"Language: en\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. Example of i18n usage | ||
#: hello.c:17 | ||
#, c-format | ||
msgid "hello" | ||
msgstr "hello" |
Binary file added
BIN
+460 Bytes
recipes/gettext/all/test_package/po/es/conan.mo.workaround_git_ignore
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Conan 1.0. | ||
# Copyright (C) Bincrafters | ||
# This file is distributed under the same license as the Conan package. | ||
# Bincrafters <bincrafters@gmail.com>, 2019. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: conan 1.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-07-11 03:48-0700\n" | ||
"PO-Revision-Date: 2019-07-11 03:58-0700\n" | ||
"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 <sse4@desktop-hhn0eap>\n" | ||
"Language-Team: Spanish\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. Example of i18n usage | ||
#: hello.c:17 | ||
#, c-format | ||
msgid "hello" | ||
msgstr "holla" |
Binary file added
BIN
+535 Bytes
recipes/gettext/all/test_package/po/ru/conan.mo.workaround_git_ignore
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Conan 1.0. | ||
# Copyright (C) Bincrafters | ||
# This file is distributed under the same license as the Conan package. | ||
# Bincrafters <bincrafters@gmail.com>, 2019. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: conan 1.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-07-11 03:48-0700\n" | ||
"PO-Revision-Date: 2019-07-11 03:58-0700\n" | ||
"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 <sse4@desktop-hhn0eap>\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" | ||
msgstr "privet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <locale.h> | ||
#include <libintl.h> | ||
|
||
int main(int argc, char * const argv[]) | ||
{ | ||
if (argc < 2) | ||
return -1; | ||
if(!bindtextdomain("conan", argv[1])) | ||
{ | ||
printf("Warning: Could not bind text domain\n"); | ||
} | ||
if(!textdomain("conan")) | ||
{ | ||
printf("Warning: Could not set text domain\n"); | ||
} | ||
if(!setlocale(LC_ALL, "")) | ||
{ | ||
printf("Warning: could not set locale\n"); | ||
} | ||
const char * lang = getenv("LANG"); | ||
lang = lang ? lang : ""; | ||
printf("hello in %s: %s\n", lang, gettext("hello")); | ||
return 0; | ||
} |