Dynamically import() files

Andre Pany andre at s-e-a-p.de
Mon Oct 23 12:15:17 UTC 2017


Hi,

I have a folder "i18n" which contains message bundle files. For 
now it contains only the message bundle file written by the 
developer: "messagebundle.properties".

During the translation process additional message bundle files 
will be added to github:
messagebundle_en.properties
messagebundle_de.properties
...
Changing the github content will automatically triggering the 
compilation process.
My wish is, that every time a new message bundle file is added, 
these file is automatically included into the compilation process.


I doubt, but is there a possibility to check during compile time 
which files exists in the
i18n folder and import() these files?

I see currently only 1 chance: Create a list of all possible 
language code (max 7) and check whether the import works via 
__traits(compiles,...).

Something like:
alias languages = TypeTuple!("en", "de");
static foreach(lang; languages)
{
...
}

Kind regards
André


More information about the Digitalmars-d-learn mailing list