C Lumen is a multilingual source-to-source prepass for C/C++ that enables developers to write localized keywords in Spanish (es) and Chinese (zh) while compiling with standard Clang/GCC. The system is deterministic, safe, and editor-agnostic.
C Lumen provides keyword-only localization for C/C++ code. It translates language keywords (like if → si in Spanish, 如果 in Chinese) while preserving all identifiers, headers, and library symbols. This allows developers to write code in their native language while maintaining full compatibility with existing build systems and toolchains.
- NFC Normalization: All input is normalized to Unicode NFC form
- Bidirectional Override Protection: Rejects potentially dangerous Unicode bidi overrides
- Confusable Detection: Warns about visually similar characters that could cause security issues
- Deterministic Output: Same input always produces the same canonical output
# Build from source
git clone https://github.com/c-lumen/c-lumen.git
cd c-lumen
cargo build --release# Translate Spanish keywords to canonical C++
clumen apply --lang es --in examples/ahorcado_es.clumen.c --out build/ahorcado.c
# Compile the canonical output
cc build/ahorcado.c -o build/ahorcado && ./build/ahorcado- Install the C Lumen extension from the VS Code marketplace
- Open a
.clumen.cor.clumen.cppfile - Enjoy syntax highlighting and semantic tokens for localized keywords
- Go to Settings → Editor → TextMate Bundles
- Import the
textmate-bundle/c-lumen.tmLanguage.jsonfile - Restart your IDE
Use the provided CMake helper for seamless build system integration:
include(tools/cmake/ClumenPrepass.cmake)
# Add your localized source files
clumen_translate(TRANSLATED_SOURCES
src/main.clumen.cpp
src/utils.clumen.c
)
# Use the translated sources in your target
add_executable(myapp ${TRANSLATED_SOURCES})si→ifsino→elsemientras→whilepara→forretornar→return- And many more...
如果→if否则→else当→while为→for返回→return- And many more...
Check out the examples/ directory for complete working examples:
ahorcado_es.clumen.c- Hangman game with Spanish keywords排序_zh.clumen.cpp- Sorting algorithm with Chinese keywords
✅ Translated:
- Language keywords (
if,while,for, etc.) - Preprocessor directives (
#include→#incluir)
❌ NOT Translated:
- Function names
- Variable names
- Header file names
- Library symbols
- API names
C Lumen includes several security measures:
- Unicode normalization prevents canonicalization attacks
- Bidirectional override detection prevents text direction attacks
- Confusable character detection warns about potential spoofing
- Source maps enable precise error reporting
See SECURITY.md for detailed security information.
We welcome contributions! Please see CONTRIBUTING.md for guidelines on:
- Adding new keywords
- Extending language support
- Running tests
- Code of conduct
C Lumen is licensed under the Apache License 2.0. See LICENSE for details.
- Additional language support (French, German, Japanese)
- Clangd integration for enhanced diagnostics
- Git clean/smudge filters for transparent localization
- WebAssembly tokenizer for browser-based development