From 0f47660b4cfba17b118db290b7433f3838ca0be9 Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Fri, 19 Jan 2024 11:53:46 -0500 Subject: [PATCH 1/8] rename files --- .../\350\241\214\344\270\272\345\256\210\345\210\231.md" | 0 l10n/zh-cn/README.md => "l10n/zh-cn/\350\207\252\350\277\260.md" | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename l10n/zh-cn/docs/CODE_OF_CONDUCT.md => "l10n/zh-cn/\346\226\207\346\241\243/\350\241\214\344\270\272\345\256\210\345\210\231.md" (100%) rename l10n/zh-cn/README.md => "l10n/zh-cn/\350\207\252\350\277\260.md" (100%) diff --git a/l10n/zh-cn/docs/CODE_OF_CONDUCT.md "b/l10n/zh-cn/\346\226\207\346\241\243/\350\241\214\344\270\272\345\256\210\345\210\231.md" similarity index 100% rename from l10n/zh-cn/docs/CODE_OF_CONDUCT.md rename to "l10n/zh-cn/\346\226\207\346\241\243/\350\241\214\344\270\272\345\256\210\345\210\231.md" diff --git a/l10n/zh-cn/README.md "b/l10n/zh-cn/\350\207\252\350\277\260.md" similarity index 100% rename from l10n/zh-cn/README.md rename to "l10n/zh-cn/\350\207\252\350\277\260.md" From 1f9ea0f9358b4a38b0e78ecd18bb32eb24f5a663 Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Sat, 20 Jan 2024 09:40:20 -0500 Subject: [PATCH 2/8] add localized logo --- README.md | 6 +- "l10n/zh-cn/\350\207\252\350\277\260.md" | 24 ++ ...7\345\222\214\345\220\215\345\255\227.svg" | 326 ++++++++++++++++++ 3 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 "l10n/zh-cn/\350\265\204\344\272\247/\346\240\207\345\277\227\345\222\214\345\220\215\345\255\227.svg" diff --git a/README.md b/README.md index eafad2350..c4cd70343 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Stumpless logo](assets/logo-and-name.svg) +![Stumpless logo](./assets/logo-and-name.svg) **A C logging library built for high performance and a rich feature set.** @@ -11,6 +11,10 @@ [![Apache 2.0 License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1-ff69b4.svg)](https://github.com/goatshriek/stumpless/blob/latest/docs/CODE_OF_CONDUCT.md) + +[简体中文](./l10n/zh-cn/自述.md) + + [Key Features](#key-features) | [Build and Install](#quick-build-and-install) | [Basic Usage](#basic-usage) | diff --git "a/l10n/zh-cn/\350\207\252\350\277\260.md" "b/l10n/zh-cn/\350\207\252\350\277\260.md" index e69de29bb..4b4a508bd 100644 --- "a/l10n/zh-cn/\350\207\252\350\277\260.md" +++ "b/l10n/zh-cn/\350\207\252\350\277\260.md" @@ -0,0 +1,24 @@ +![无树桩的标志](./资产/标志和名字.svg) + +**A C logging library built for high performance and a rich feature set.** + +[![Linux Builds](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml) +[![Windows Builds](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml) +[![Mac Builds](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml) +[![Coverage Report](https://codecov.io/gh/goatshriek/stumpless/branch/latest/graph/badge.svg)](https://codecov.io/gh/goatshriek/stumpless) +[![SonarCloud Status](https://sonarcloud.io/api/project_badges/measure?project=stumpless&metric=alert_status)](https://sonarcloud.io/dashboard?id=stumpless) +[![Gitter](https://badges.gitter.im/stumpless/community.svg)](https://gitter.im/stumpless/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Apache 2.0 License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![贡献者公约](https://img.shields.io/badge/%E8%B4%A1%E7%8C%AE%E8%80%85%E5%85%AC%E7%BA%A6-v2.1-ff69b4.svg)](https://github.com/goatshriek/stumpless/blob/latest/l10n/zh-cn/文档/行为守则.md) + + +[English](./../../README.md) + + +[Key Features](#key-features) | +[Build and Install](#quick-build-and-install) | +[Basic Usage](#basic-usage) | +[Contributing](#contributing) + + +## Key Features diff --git "a/l10n/zh-cn/\350\265\204\344\272\247/\346\240\207\345\277\227\345\222\214\345\220\215\345\255\227.svg" "b/l10n/zh-cn/\350\265\204\344\272\247/\346\240\207\345\277\227\345\222\214\345\220\215\345\255\227.svg" new file mode 100644 index 000000000..7401e13a4 --- /dev/null +++ "b/l10n/zh-cn/\350\265\204\344\272\247/\346\240\207\345\277\227\345\222\214\345\220\215\345\255\227.svg" @@ -0,0 +1,326 @@ + + + +无树桩 From b9f20daaaf7727f19dd12d33ac2b04a703a0039a Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Sat, 20 Jan 2024 11:04:57 -0500 Subject: [PATCH 3/8] localize links and badges --- "l10n/zh-cn/\350\207\252\350\277\260.md" | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git "a/l10n/zh-cn/\350\207\252\350\277\260.md" "b/l10n/zh-cn/\350\207\252\350\277\260.md" index 4b4a508bd..a39d1760f 100644 --- "a/l10n/zh-cn/\350\207\252\350\277\260.md" +++ "b/l10n/zh-cn/\350\207\252\350\277\260.md" @@ -1,24 +1,22 @@ ![无树桩的标志](./资产/标志和名字.svg) -**A C logging library built for high performance and a rich feature set.** +**高性能,很多特征的C日志库** -[![Linux Builds](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml) -[![Windows Builds](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml) -[![Mac Builds](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml) -[![Coverage Report](https://codecov.io/gh/goatshriek/stumpless/branch/latest/graph/badge.svg)](https://codecov.io/gh/goatshriek/stumpless) -[![SonarCloud Status](https://sonarcloud.io/api/project_badges/measure?project=stumpless&metric=alert_status)](https://sonarcloud.io/dashboard?id=stumpless) +[![Linux编译](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/linux.yml) +[![Windows编译](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/windows.yml) +[![macOS编译](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml/badge.svg)](https://github.com/goatshriek/stumpless/actions/workflows/mac.yml) +[![代碼覆蓋率报告](https://codecov.io/gh/goatshriek/stumpless/branch/latest/graph/badge.svg)](https://codecov.io/gh/goatshriek/stumpless) +[![SonarCloud地位](https://sonarcloud.io/api/project_badges/measure?project=stumpless&metric=alert_status)](https://sonarcloud.io/dashboard?id=stumpless) [![Gitter](https://badges.gitter.im/stumpless/community.svg)](https://gitter.im/stumpless/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -[![Apache 2.0 License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![Apache 2.0许可证](https://img.shields.io/badge/%E8%AE%B8%E5%8F%AF%E8%AF%81-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![贡献者公约](https://img.shields.io/badge/%E8%B4%A1%E7%8C%AE%E8%80%85%E5%85%AC%E7%BA%A6-v2.1-ff69b4.svg)](https://github.com/goatshriek/stumpless/blob/latest/l10n/zh-cn/文档/行为守则.md) [English](./../../README.md) -[Key Features](#key-features) | -[Build and Install](#quick-build-and-install) | -[Basic Usage](#basic-usage) | -[Contributing](#contributing) +[重要特征](#重要特征) -## Key Features +## 重要特征 +TODO \ No newline at end of file From 1152cd8d68138bf3e9b508d733a3b72baf934195 Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Sun, 21 Jan 2024 08:33:51 -0500 Subject: [PATCH 4/8] add doxygen l10n for zh-cn --- .github/workflows/locale.yml | 41 +++++----- CMakeLists.txt | 71 +---------------- .../\345\214\205\345\220\253/stumpless.h" | 27 +++++++ tools/cmake/l10n.cmake | 77 +++++++++++++++++++ tools/doxygen/Doxyfile.in | 12 +-- 5 files changed, 136 insertions(+), 92 deletions(-) create mode 100644 "l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" create mode 100644 tools/cmake/l10n.cmake diff --git a/.github/workflows/locale.yml b/.github/workflows/locale.yml index a2d2d9275..1fe47622f 100644 --- a/.github/workflows/locale.yml +++ b/.github/workflows/locale.yml @@ -12,7 +12,7 @@ env: jobs: linux-de-de: name: "linux, de-de" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "de_DE.UTF-8" steps: @@ -32,7 +32,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-cz-cz: name: "linux, cz-cz" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "cz_ES.UTF-8" steps: @@ -52,7 +52,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-es-es: name: "linux, es-es" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "es_ES.UTF-8" steps: @@ -72,7 +72,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-fr-fr: name: "linux, fr-fr" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "fr_FR.UTF-8" steps: @@ -92,7 +92,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-it-it: name: "linux, it-it" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "it_IT.UTF-8" steps: @@ -112,7 +112,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-sk-sk: name: "linux, sk-sk" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "sk_SK.UTF-8" steps: @@ -132,7 +132,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-tr-tr: name: "linux, tr-tr" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "tr_TR.UTF-8" steps: @@ -152,7 +152,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-pl-pl: name: "linux, pl-pl" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "pl_PL.UTF-8" steps: @@ -172,7 +172,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-sq-al: name: "linux, sq-al" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "sq_AL.UTF-8" steps: @@ -192,7 +192,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-sv-se: name: "linux, sv-se" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "sv_SE.UTF-8" steps: @@ -212,7 +212,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-bg-bg: name: "linux, bg-bg" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "bg_BG.UTF-8" steps: @@ -232,7 +232,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-el-gr: name: "linux, el-gr" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "el_GR.UTF-8" steps: @@ -252,7 +252,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-sw-ke: name: "linux, sw-ke" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "sw-KE.UTF-8" steps: @@ -272,7 +272,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-pt-br: name: "linux, pt-br" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "pt_BR.UTF-8" steps: @@ -292,7 +292,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-zh-cn: name: "linux, zh-cn" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "zh_CN.UTF-8" steps: @@ -310,9 +310,12 @@ jobs: run: | make check if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi + - name: Docs + run: | + make docs linux-hi-in: name: "linux, hi-in" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "hi_IN.UTF-8" steps: @@ -332,7 +335,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-bn-in: name: "linux, bn-in" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "bn_IN.UTF-8" steps: @@ -352,7 +355,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-da-dk: name: "linux, da-dk" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "da_DK.UTF-8" steps: @@ -372,7 +375,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-he-il: name: "linux, he-il" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "he_IL.UTF-8" steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 39c1529d9..5996b00dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ include(tools/cmake/add_found_library.cmake) include(tools/cmake/benchmark.cmake) include(tools/cmake/example.cmake) include(tools/cmake/gtest.cmake) +include(tools/cmake/l10n.cmake) include(tools/cmake/swig.cmake) include(tools/cmake/test.cmake) @@ -193,72 +194,6 @@ else() set(STUMPLESS_DEFAULT_SOCKET "/dev/log") endif() -# setting the chosen locale -if(LOCALE MATCHES "^es[_-]") - set(STUMPLESS_LANGUAGE "es-ES") - set(USE_LOCALE_ES_ES TRUE) -elseif(LOCALE MATCHES "^fr[_-]") - set(STUMPLESS_LANGUAGE "fr-FR") - set(USE_LOCALE_FR_FR TRUE) -elseif(LOCALE MATCHES "^de[_-]") - set(STUMPLESS_LANGUAGE "de-DE") - set(USE_LOCALE_DE_DE TRUE) -elseif(LOCALE MATCHES "^it[_-]") - set(STUMPLESS_LANGUAGE "it-IT") - set(USE_LOCALE_IT_IT TRUE) -elseif(LOCALE MATCHES "^sv[_-]") - set(STUMPLESS_LANGUAGE "sv-SE") - set(USE_LOCALE_SV_SE TRUE) -elseif(LOCALE MATCHES "^sk[_-]") - set(STUMPLESS_LANGUAGE "sk-SK") - set(USE_LOCALE_SK_SK TRUE) -elseif(LOCALE MATCHES "^bg[_-]") - set(STUMPLESS_LANGUAGE "bg-BG") - set(USE_LOCALE_BG_BG TRUE) -elseif(LOCALE MATCHES "^cz[_-]") - set(STUMPLESS_LANGUAGE "cz-CZ") - set(USE_LOCALE_CZ_CZ TRUE) -elseif(LOCALE MATCHES "^pl[_-]") - set(STUMPLESS_LANGUAGE "pl-PL") - set(USE_LOCALE_PL_PL TRUE) -elseif(LOCALE MATCHES "^sw[_-]") - set(STUMPLESS_LANGUAGE "sw-KE") - set(USE_LOCALE_SW_KE TRUE) -elseif(LOCALE MATCHES "^el[_-]") - set(STUMPLESS_LANGUAGE "el-GR") - set(USE_LOCALE_EL_GR TRUE) -elseif(LOCALE MATCHES "^pt[_-]") - set(STUMPLESS_LANGUAGE "pt-BR") - set(USE_LOCALE_PT_BR TRUE) -elseif(LOCALE MATCHES "^zh[_-]") - set(STUMPLESS_LANGUAGE "zh-CN") - set(USE_LOCALE_ZH_CN TRUE) -elseif(LOCALE MATCHES "^hi[_-]") - set(STUMPLESS_LANGUAGE "hi-IN") - set(USE_LOCALE_HI_IN TRUE) -elseif(LOCALE MATCHES "^bn[_-]") - set(STUMPLESS_LANGUAGE "bn-IN") - set(USE_LOCALE_BN_IN TRUE) -elseif(LOCALE MATCHES "^da[_-]") - set(STUMPLESS_LANGUAGE "da-DK") - set(USE_LOCALE_DA_DK TRUE) -elseif(LOCALE MATCHES "^he[_-]") - set(STUMPLESS_LANGUAGE "he-IL") - set(USE_LOCALE_HE_IL TRUE) -elseif(LOCALE MATCHES "^tr[_-]") - set(STUMPLESS_LANGUAGE "tr-TR") - set(USE_LOCALE_TR_TR TRUE) -elseif(LOCALE MATCHES "^sq[_-]") - set(STUMPLESS_LANGUAGE "sq-AL") - set(USE_LOCALE_SQ_AL TRUE) -else() - if(NOT LOCALE MATCHES "^en[_-]") - message("building default language en-US") - endif() - set(STUMPLESS_LANGUAGE "en-US") - set(USE_LOCALE_EN_US TRUE) -endif() - # standard source files set(STUMPLESS_SOURCES ${PROJECT_SOURCE_DIR}/src/cache.c @@ -1219,7 +1154,7 @@ endif() if(DOXYGEN_FOUND) configure_file(${PROJECT_SOURCE_DIR}/tools/doxygen/Doxyfile.in ${PROJECT_BINARY_DIR}/tools/doxygen/Doxyfile) - file(GLOB_RECURSE DOXYGEN_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/include/stumpless/*.h) + file(GLOB_RECURSE DOXYGEN_PUBLIC_HEADERS ${DOXYGEN_INCLUDE_DIR}/stumpless/*.h) set(EXAMPLE_SOURCES ${PROJECT_SOURCE_DIR}/docs/examples/basic/basic_example.c ) @@ -1231,7 +1166,7 @@ if(DOXYGEN_FOUND) DEPENDS ${DOXYGEN_PUBLIC_HEADERS} ${EXAMPLE_SOURCES} - ${PROJECT_SOURCE_DIR}/include/stumpless.h + ${DOXYGEN_INCLUDE_DIR}/stumpless.h ${PROJECT_BINARY_DIR}/include/stumpless/config.h VERBATIM ) diff --git "a/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" "b/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" new file mode 100644 index 000000000..08d261705 --- /dev/null +++ "b/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* + * Copyright 2024 Joel E. Anderson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** @mainpage 无树桩 + * + * \~Chinese 无树桩是一个高性能,很多特征的C日志库。 + */ + +/** @example basic_example.c + * \~Chinese 什么什么什么 + */ diff --git a/tools/cmake/l10n.cmake b/tools/cmake/l10n.cmake new file mode 100644 index 000000000..da992a512 --- /dev/null +++ b/tools/cmake/l10n.cmake @@ -0,0 +1,77 @@ +# setting the chosen locale +if(LOCALE MATCHES "^es[_-]") + set(STUMPLESS_LANGUAGE "es-ES") + set(USE_LOCALE_ES_ES TRUE) +elseif(LOCALE MATCHES "^fr[_-]") + set(STUMPLESS_LANGUAGE "fr-FR") + set(USE_LOCALE_FR_FR TRUE) +elseif(LOCALE MATCHES "^de[_-]") + set(STUMPLESS_LANGUAGE "de-DE") + set(USE_LOCALE_DE_DE TRUE) +elseif(LOCALE MATCHES "^it[_-]") + set(STUMPLESS_LANGUAGE "it-IT") + set(USE_LOCALE_IT_IT TRUE) +elseif(LOCALE MATCHES "^sv[_-]") + set(STUMPLESS_LANGUAGE "sv-SE") + set(USE_LOCALE_SV_SE TRUE) +elseif(LOCALE MATCHES "^sk[_-]") + set(STUMPLESS_LANGUAGE "sk-SK") + set(USE_LOCALE_SK_SK TRUE) +elseif(LOCALE MATCHES "^bg[_-]") + set(STUMPLESS_LANGUAGE "bg-BG") + set(USE_LOCALE_BG_BG TRUE) +elseif(LOCALE MATCHES "^cz[_-]") + set(STUMPLESS_LANGUAGE "cz-CZ") + set(USE_LOCALE_CZ_CZ TRUE) +elseif(LOCALE MATCHES "^pl[_-]") + set(STUMPLESS_LANGUAGE "pl-PL") + set(USE_LOCALE_PL_PL TRUE) +elseif(LOCALE MATCHES "^sw[_-]") + set(STUMPLESS_LANGUAGE "sw-KE") + set(USE_LOCALE_SW_KE TRUE) +elseif(LOCALE MATCHES "^el[_-]") + set(STUMPLESS_LANGUAGE "el-GR") + set(USE_LOCALE_EL_GR TRUE) +elseif(LOCALE MATCHES "^pt[_-]") + set(STUMPLESS_LANGUAGE "pt-BR") + set(USE_LOCALE_PT_BR TRUE) +elseif(LOCALE MATCHES "^zh[_-]") + set(STUMPLESS_LANGUAGE "zh-CN") + set(USE_LOCALE_ZH_CN TRUE) +elseif(LOCALE MATCHES "^hi[_-]") + set(STUMPLESS_LANGUAGE "hi-IN") + set(USE_LOCALE_HI_IN TRUE) +elseif(LOCALE MATCHES "^bn[_-]") + set(STUMPLESS_LANGUAGE "bn-IN") + set(USE_LOCALE_BN_IN TRUE) +elseif(LOCALE MATCHES "^da[_-]") + set(STUMPLESS_LANGUAGE "da-DK") + set(USE_LOCALE_DA_DK TRUE) +elseif(LOCALE MATCHES "^he[_-]") + set(STUMPLESS_LANGUAGE "he-IL") + set(USE_LOCALE_HE_IL TRUE) +elseif(LOCALE MATCHES "^tr[_-]") + set(STUMPLESS_LANGUAGE "tr-TR") + set(USE_LOCALE_TR_TR TRUE) +elseif(LOCALE MATCHES "^sq[_-]") + set(STUMPLESS_LANGUAGE "sq-AL") + set(USE_LOCALE_SQ_AL TRUE) +else() + if(NOT LOCALE MATCHES "^en[_-]") + message("building default language en-US") + endif() + set(STUMPLESS_LANGUAGE "en-US") + set(USE_LOCALE_EN_US TRUE) +endif() + + +# set the doxygen input files +if(USE_LOCALE_ZH_CN) + set(DOXYGEN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/l10n/zh-cn/包含") + set(DOXYGEN_OUTPUT_LANGUAGE "Chinese") +else() # default to USE_LOCALE_EN_US + set(DOXYGEN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/") + set(DOXYGEN_OUTPUT_LANGUAGE "English") +endif() + +set(DOXYGEN_INPUT "${DOXYGEN_INCLUDE_DIR}/stumpless.h ${DOXYGEN_INCLUDE_DIR}/stumpless ${PROJECT_BINARY_DIR}/include/stumpless") diff --git a/tools/doxygen/Doxyfile.in b/tools/doxygen/Doxyfile.in index e4562ed39..afbd3e12c 100644 --- a/tools/doxygen/Doxyfile.in +++ b/tools/doxygen/Doxyfile.in @@ -2,21 +2,22 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "stumpless" PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ -INPUT = @PROJECT_SOURCE_DIR@/include/stumpless.h @PROJECT_SOURCE_DIR@/include/stumpless @PROJECT_BINARY_DIR@/include/stumpless +INPUT = @DOXYGEN_INPUT@ OUTPUT_DIRECTORY = @PROJECT_DOCS_DIR@ CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English +OUTPUT_LANGUAGE = @DOXYGEN_OUTPUT_LANGUAGE@ FILE_PATTERNS = *.h FULL_PATH_NAMES = YES -STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/include @PROJECT_BINARY_DIR@/include +STRIP_FROM_PATH = @DOXYGEN_INCLUDE_DIR@ @PROJECT_BINARY_DIR@/include OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +ALLOW_UNICODE_NAMES = YES SEARCH_INCLUDES = YES -INCLUDE_PATH = @PROJECT_SOURCE_DIR@/include @PROJECT_BINARY_DIR@/include +INCLUDE_PATH = @DOXYGEN_INCLUDE_DIR@ @PROJECT_BINARY_DIR@/include MACRO_EXPANSION = YES ENABLE_PREPROCESSING = YES EXPAND_ONLY_PREDEF = YES @@ -27,6 +28,8 @@ EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/docs/examples EXAMPLE_PATTERNS = *.c *.cpp EXAMPLE_RECURSIVE = NO +GENERATE_TREEVIEW = YES + GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html @@ -134,7 +137,6 @@ QHP_VIRTUAL_FOLDER = doc GENERATE_ECLIPSEHELP = NO ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO From d3e953001c71114670f2fed583d92a20f1bb300a Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Sun, 21 Jan 2024 08:47:45 -0500 Subject: [PATCH 5/8] update l10n docs --- docs/localization.md | 20 ++++++++++---------- tools/cmake/l10n.cmake | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/localization.md b/docs/localization.md index ba44939dd..0e021c85e 100644 --- a/docs/localization.md +++ b/docs/localization.md @@ -100,18 +100,18 @@ defined symbols to reflect your new locale. Be sure that the name of the new header is a valid IETF Language Tag in all lowercase letters. After adding the header itself, you will need to tie it in to the build system -by updating the `CMakeList.txt` file, the `include/private/config.h.in` +by updating the `tools/cmake/l10n.cmake` file, the `include/private/config.h.in` header template, and the locale wrapper `include/private/config/locale/wrapper.h`. In the CMake script, add an `elseif` -block to the chain of conditionals responsible for determining the locale (do a -search for `STUMPLESS_LANGUAGE` to quickly find this) following the pattern of -the others that are already there. Next, in the private config header template, -add a definition for the locale symbol for the new locale. This symbol should -be of the form `USE_LOCALE_XXX` where the last portion is the RFC 5646 language -tag in all caps with underscore separators. Again, reference the already defined -locales to see what this should look like. Finally, in the locale wrapper header -add an `#elseif` statement for the new locale symbol in the same order as it -appears in the CMake build script to include the new header. +block to the chain of conditionals responsible for determining the locale +following the pattern of the others that are already there. Next, in the private +config header template, add a definition for the locale symbol for the new +locale. This symbol should be of the form `USE_LOCALE_XXX` where the last +portion is the RFC 5646 language tag in all caps with underscore separators. +Again, reference the already defined locales to see what this should look like. +Finally, in the locale wrapper header add an `#elseif` statement for the new +locale symbol in the same order as it appears in the CMake build script to +include the new header. The last step is to add new CI builds for the new locale to make sure that there are no immediate problems and catch any future ones that arise. This is diff --git a/tools/cmake/l10n.cmake b/tools/cmake/l10n.cmake index da992a512..1e55105aa 100644 --- a/tools/cmake/l10n.cmake +++ b/tools/cmake/l10n.cmake @@ -74,4 +74,6 @@ else() # default to USE_LOCALE_EN_US set(DOXYGEN_OUTPUT_LANGUAGE "English") endif() -set(DOXYGEN_INPUT "${DOXYGEN_INCLUDE_DIR}/stumpless.h ${DOXYGEN_INCLUDE_DIR}/stumpless ${PROJECT_BINARY_DIR}/include/stumpless") +# we add the source dir include path at the very end so that any elements not +# documented in the localized headers get default documentation of English +set(DOXYGEN_INPUT "${DOXYGEN_INCLUDE_DIR}/stumpless.h ${DOXYGEN_INCLUDE_DIR}/stumpless ${PROJECT_BINARY_DIR}/include/stumpless ${PROJECT_SOURCE_DIR}/include/stumpless ") From bc1910307230aa476edb12993b7e4cfd01205471 Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Tue, 23 Jan 2024 20:41:18 -0500 Subject: [PATCH 6/8] fill out basic readme --- README.md | 16 ++--- .../\345\214\205\345\220\253/stumpless.h" | 4 +- .../\347\256\200\345\215\225/basic_example.c" | 62 +++++++++++++++++++ .../\350\207\252\350\277\260.md" | 1 + "l10n/zh-cn/\350\207\252\350\277\260.md" | 7 ++- tools/cmake/l10n.cmake | 3 + tools/doxygen/Doxyfile.in | 5 +- 7 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 "l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/basic_example.c" create mode 100644 "l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/\350\207\252\350\277\260.md" diff --git a/README.md b/README.md index c4cd70343..33ff75747 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,16 @@ ## Key Features -Stumpless offers a robust set of features to make logging in C faster and -easier: - * easy logging to [lots of things](#what-can-it-log-to) like Splunk, rsyslog, +Stumpless has lots of features that make logging in C fast and easy: + * log to [lots of things](#what-can-it-log-to) like Splunk, rsyslog, journald, the Windows Event Log, and more! * structured and unstructured logging to suit your needs - * interoperable with common log daemons and libraries * builds for Linux, Windows, Mac, MinGW, MSYS2, Cygwin, and more - * completely thread safe - * can be adjusted or removed during compilation for zero runtime impact - * localized for multiple languages :brazil: :bulgaria: :cn: :czech_republic: - :de: :es: :fr: :greece: :india: :it: :poland: :slovakia: :sweden: :tr: :us: :denmark: :israel: :kenya: :albania: + * thread safe + * can be adjusted or removed during compilation for zero runtime cost + * localized for multiple languages :albania: :brazil: :bulgaria: :cn: + :czech_republic: :de: :denmark: :es: :fr: :greece: :india: :israel: :it: + :kenya: :poland: :slovakia: :sweden: :tr: :us: ([add yours!](https://github.com/goatshriek/stumpless/blob/latest/docs/localization.md)) * easy-access [documentation](https://goatshriek.github.io/stumpless/docs/c/latest/index.html), @@ -50,6 +49,7 @@ and plugins to get them where you want. Stumpless can write logs to: * Unix sockets (such as a local syslog daemon) * Network Servers (IPv4 or IPv6, TCP or UDP) * Systemd Journald Service + * Sqlite3 Databases * Windows Event Log * Custom functions, for whatever else you may need! diff --git "a/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" "b/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" index 08d261705..e5add74d2 100644 --- "a/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" +++ "b/l10n/zh-cn/\345\214\205\345\220\253/stumpless.h" @@ -19,9 +19,9 @@ /** @mainpage 无树桩 * - * \~Chinese 无树桩是一个高性能,很多特征的C日志库。 + * 无树桩是一个高性能,很多特征的C日志库。 */ /** @example basic_example.c - * \~Chinese 什么什么什么 + * 简单的示例。 */ diff --git "a/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/basic_example.c" "b/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/basic_example.c" new file mode 100644 index 000000000..51171377e --- /dev/null +++ "b/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/basic_example.c" @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 + +/* + * Copyright 2019-2022 Joel E. Anderson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +int +main( int argc, char **argv ) { + struct stumpless_target *file_target; + struct stumpless_target *net_target; + const char *username = "example-username"; + + + // opens a file target to example.log + file_target = stumpless_open_file_target( "example.log" ); + + + // logs to the last opened target + stump( "The hello world of stumpless." ); + + + // logs a more complex message to the last target + stump( "Login failed for username %s", username ); + + // uses the _str version of stump to avoid format specifier issues + stump_str( "Use of %s to print a value!" ); + +#ifdef STUMPLESS_NETWORK_TARGETS_SUPPORTED + // opens a network target to example.com using UDP over IPv4 + net_target = stumpless_open_udp4_target( "network-target", "example.com" ); + + + // sends a message to the network target + stumpless_add_message( net_target, "Login failed for username %s", username ); +#endif + + + // destroying all the resources before finishing up + stumpless_close_file_target( file_target ); +#ifdef STUMPLESS_NETWORK_TARGETS_SUPPORTED + stumpless_close_network_target( net_target ); +#endif + stumpless_free_all( ); + + + return EXIT_SUCCESS; +} diff --git "a/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/\350\207\252\350\277\260.md" "b/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/\350\207\252\350\277\260.md" new file mode 100644 index 000000000..1edd0be9c --- /dev/null +++ "b/l10n/zh-cn/\346\226\207\346\241\243/\347\244\272\344\276\213/\347\256\200\345\215\225/\350\207\252\350\277\260.md" @@ -0,0 +1 @@ +# 简单 diff --git "a/l10n/zh-cn/\350\207\252\350\277\260.md" "b/l10n/zh-cn/\350\207\252\350\277\260.md" index a39d1760f..480094292 100644 --- "a/l10n/zh-cn/\350\207\252\350\277\260.md" +++ "b/l10n/zh-cn/\350\207\252\350\277\260.md" @@ -19,4 +19,9 @@ ## 重要特征 -TODO \ No newline at end of file +无树桩有很多特征做C日志又快又容易: + * 线程安全 + * 访问得容易的 + [文档](https://goatshriek.github.io/stumpless/docs/c/latest/index.html), + [示例](https://github.com/goatshriek/stumpless/tree/latest/docs/examples), + [支持](https://gitter.im/stumpless/community)。 diff --git a/tools/cmake/l10n.cmake b/tools/cmake/l10n.cmake index 1e55105aa..a574599ac 100644 --- a/tools/cmake/l10n.cmake +++ b/tools/cmake/l10n.cmake @@ -68,12 +68,15 @@ endif() # set the doxygen input files if(USE_LOCALE_ZH_CN) set(DOXYGEN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/l10n/zh-cn/包含") + set(DOXYGEN_EXAMPLE_DIR "${PROJECT_SOURCE_DIR}/l10n/zh-cn/文档/示例") set(DOXYGEN_OUTPUT_LANGUAGE "Chinese") else() # default to USE_LOCALE_EN_US set(DOXYGEN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/") + set(DOXYGEN_EXAMPLE_DIR "${PROJECT_SOURCE_DIR}/docs/examples") set(DOXYGEN_OUTPUT_LANGUAGE "English") endif() + # we add the source dir include path at the very end so that any elements not # documented in the localized headers get default documentation of English set(DOXYGEN_INPUT "${DOXYGEN_INCLUDE_DIR}/stumpless.h ${DOXYGEN_INCLUDE_DIR}/stumpless ${PROJECT_BINARY_DIR}/include/stumpless ${PROJECT_SOURCE_DIR}/include/stumpless ") diff --git a/tools/doxygen/Doxyfile.in b/tools/doxygen/Doxyfile.in index afbd3e12c..231c40ade 100644 --- a/tools/doxygen/Doxyfile.in +++ b/tools/doxygen/Doxyfile.in @@ -1,5 +1,7 @@ # deliberate settings DOXYFILE_ENCODING = UTF-8 +INPUT_ENCODING = UTF-8 +INPUT_FILE_ENCODING = UTF-8 PROJECT_NAME = "stumpless" PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ INPUT = @DOXYGEN_INPUT@ @@ -24,7 +26,7 @@ EXPAND_ONLY_PREDEF = YES PREDEFINED = __attribute__(x)= SHOW_INCLUDE_FILES = NO -EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/docs/examples +EXAMPLE_PATH = @DOXYGEN_EXAMPLE_DIR@ EXAMPLE_PATTERNS = *.c *.cpp EXAMPLE_RECURSIVE = NO @@ -107,7 +109,6 @@ WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES WARN_FORMAT = "$file:$line: $text" -INPUT_ENCODING = UTF-8 RECURSIVE = YES EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = *scripts* From 2d2019968db38b6af88b25ee38e0162def743cca Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Tue, 23 Jan 2024 20:49:11 -0500 Subject: [PATCH 7/8] add hu to l10n file --- tools/cmake/l10n.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/cmake/l10n.cmake b/tools/cmake/l10n.cmake index a574599ac..991e97232 100644 --- a/tools/cmake/l10n.cmake +++ b/tools/cmake/l10n.cmake @@ -53,6 +53,9 @@ elseif(LOCALE MATCHES "^he[_-]") elseif(LOCALE MATCHES "^tr[_-]") set(STUMPLESS_LANGUAGE "tr-TR") set(USE_LOCALE_TR_TR TRUE) +elseif(LOCALE MATCHES "^hu[_-]") + set(STUMPLESS_LANGUAGE "hu-HU") + set(USE_LOCALE_HU_HU TRUE) elseif(LOCALE MATCHES "^sq[_-]") set(STUMPLESS_LANGUAGE "sq-AL") set(USE_LOCALE_SQ_AL TRUE) From 7419b1ea768ee67ab5a290527c3c42fe26edd132 Mon Sep 17 00:00:00 2001 From: Joel Anderson Date: Tue, 23 Jan 2024 20:50:19 -0500 Subject: [PATCH 8/8] make hu build latest --- .github/workflows/locale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/locale.yml b/.github/workflows/locale.yml index 2b737a4ab..f384b1885 100644 --- a/.github/workflows/locale.yml +++ b/.github/workflows/locale.yml @@ -172,7 +172,7 @@ jobs: if grep "DEPRECATED" Testing/Temporary/LastTest.log; then exit 1; fi linux-hu-hu: name: "linux, hu-hu" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" env: LANG: "hu_HU.UTF-8" steps: