-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a24e4fa
commit 9b2e290
Showing
8 changed files
with
95 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
project(locales C) | ||
cmake_minimum_required(VERSION 2.8) | ||
include(GNUInstallDirs) | ||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
set(LOCALE_SOURCES locale.c categories.c categories.h) | ||
configure_file(config.h.in config.h) | ||
configure_file(locale.in 00locale.sh) | ||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) | ||
set(GETTEXT_PACKAGE "musl-locales") | ||
set(MUSL_LOCPATH ${CMAKE_INSTALL_DATAROOTDIR}/i18n/locales/musl CACHE PATH "Locales directory" FORCE) | ||
set(LOCALE_SOURCES locale.c categories.c categories.h config.h) | ||
add_executable(locale ${LOCALE_SOURCES}) | ||
install(PROGRAMS 00locale.sh DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/profile.d") | ||
install(TARGETS locale DESTINATION bin) | ||
add_subdirectory(po) |
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,3 +1,13 @@ | ||
/* | ||
* | ||
* Copyright (c) 2016 Konstantin Pugin | ||
* Konstantin Pugin ([email protected]) | ||
* | ||
* Licensed under the LGPL v3. | ||
* | ||
* A 'locale' command implementation for musl. | ||
* | ||
*/ | ||
#include "categories.h" | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
@@ -79,6 +89,19 @@ const struct cat_item get_cat_item_for_name(const char *name) | |
return invalid; | ||
} | ||
|
||
const char* get_cat_name_for_item_name(const char *name) | ||
{ | ||
for(int i = 0; i < LC_ALL; i++) | ||
{ | ||
for(int j = 0; cats[i][j].type != CAT_TYPE_END; j++) | ||
{ | ||
if(!strcmp(name,cats[i][j].name)) | ||
return get_name_for_cat(i); | ||
} | ||
} | ||
return ""; | ||
} | ||
|
||
const struct cat_item* get_cat_for_locale_cat(int locale_cat) | ||
{ | ||
return cats[locale_cat]; | ||
|
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,3 +1,13 @@ | ||
/* | ||
* | ||
* Copyright (c) 2016 Konstantin Pugin | ||
* Konstantin Pugin ([email protected]) | ||
* | ||
* Licensed under the LGPL v3. | ||
* | ||
* A 'locale' command implementation for musl. | ||
* | ||
*/ | ||
#ifndef CATEGORIES_H | ||
#define CATEGORIES_H | ||
|
||
|
@@ -29,4 +39,5 @@ const struct cat_item get_cat_item_for_name(const char* name); | |
const struct cat_item* get_cat_for_locale_cat(int locale_cat); | ||
int get_cat_num_for_name(const char *cat_name); | ||
const char* get_name_for_cat(int cat_no); | ||
const char* get_cat_name_for_item_name(const char *name); | ||
#endif // CATEGORIES_H |
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 @@ | ||
#define PACKAGE "@GETTEXT_PACKAGE@" |
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,2 @@ | ||
#!/bin/sh | ||
export MUSL_LOCPATH="@CMAKE_INSTALL_FULL_DATAROOTDIR@/@MUSL_LOCPATH@" |
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,4 +1,8 @@ | ||
include(TranslationsMusl) | ||
add_translations_directory("musl" MUSL_LOCPATH) | ||
add_translations_catalog("musl" | ||
../musl) | ||
add_musl_translations_directory("musl" MUSL_LOCPATH) | ||
add_musl_translations_catalog("musl" | ||
../musl) | ||
include(Translations) | ||
add_translations_directory("musl-locales" "bin") | ||
add_translations_catalog("musl-locales" | ||
..) |