lang-generator
A Rust procedural macro crate for generating language-related code in poly-translator.
Overview
lang-generator is a procedural macro that automatically generates:
- A comprehensive
Languageenum from ISO 639 language data - Conversion functions between language codes and enum variants
- Helper methods for language handling
Features
- Automatic Enum Generation: Generates a
Languageenum containing all ISO 639 languages - Code Mapping: Provides conversion functions between language codes and enum variants
- Bidirectional Conversion: Supports converting from language codes to enum and from enum back to codes
- Static Data: Reads from built-in CSV data for reliable language information
Usage
Add this to your Cargo.toml:
[]
= "1.0.3"
Use the procedural macro in your code:
use generate_language;
;
Generated API
The macro generates the following:
Supported Languages
The crate supports all major languages defined in the ISO 639 standard, including:
- Chinese (zh)
- English (en)
- Japanese (ja)
- Korean (ko)
- French (fr)
- German (de)
- Spanish (es)
- Russian (ru)
- And many more...
📧 Contact
If you have any questions or suggestions, please contact us through:
- Create an Issue
- Send an email to: 63542424@163.com
License
MIT