Crates.io | mauzi |
lib.rs | mauzi |
version | 0.0.2 |
source | src |
created_at | 2017-08-26 14:40:44.803271 |
updated_at | 2017-09-02 20:22:37.754844 |
description | Experimental i18n library using proc-macros |
homepage | |
repository | https://github.com/LukasKalbertodt/mauzi |
max_upload_size | |
id | 29271 |
size | 22,748 |
Library to help with internationalization. WIP. Nightly only: uses proc_macros
.
This library is very young and very unfinished. Please note that I don't know anything about internationalization and that I never used an i18n library before. I developed this library because I needed something like this for a web project of mine. This web project will drive the development of this library: experience from using the library in a real project helps a lot to shape the API of this library.
Right now this library is as unstable as a house of cards made from flerovium
in the pre-Rust-1.0 era. Partly due to my lack of understanding of certain
things, partly due to the incomplete and unstable nature of the proc_macro
feature. Here, I want to list all evil hacks I used right now.
I was unable to map mauzi-modules to Rust modules. The problem is that, from
the submodules, I need to use Dict
which is defined in the root module.
Sounds easy in theory, but due to macro hygiene (I think?) it is complicated.
Hardly any use
statements work as you would expect. Maybe it works once
this lands, maybe not. I made another comment about something similar
here. Maybe it is already possible but I'm unable to find the solution.
The current solution is to build long names for types in submodules. So instead of:
dict::bar::baz::Dict
... the type is:
dict::bar___this_is_a_bad_solution___baz___this_is_a_bad_solution___Dict
The proc macro can't find out in which file it was called. This means we don't know where to look for submodule files! This is discussed here.
The current solution uses CARGO_MANIFEST_PATH
and adds src/
. This means:
mauzi!
macro in a file which lives directly in the
src/
folder.src/
won't work at all (e.g. examples in
examples/
)Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.