digitalmars.D.learn - Dynamically import() files
- Andre Pany (27/27) Oct 23 2017 Hi,
- rikki cattermole (2/2) Oct 23 2017 Don't be afraid to write a small script that is run before a build to
- Igor (4/9) Oct 23 2017 Can't you just create all the files that you expect to have and
- Andre Pany (8/19) Oct 23 2017 Thanks for the hints. I have some concerns creating the files
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é
Oct 23 2017
Don't be afraid to write a small script that is run before a build to generate a list of files which than can be imported.
Oct 23 2017
On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote: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". [...]Can't you just create all the files that you expect to have and leave them empty and then you import them all and process them differently if there is no content?
Oct 23 2017
On Monday, 23 October 2017 at 20:13:20 UTC, Igor wrote:On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote:Thanks for the hints. I have some concerns creating the files upfront, because the files should only be created by other colleagues in an official translation process. I will check whether I can determine the files via script as proposed by Rikki. Kind regards André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". [...]Can't you just create all the files that you expect to have and leave them empty and then you import them all and process them differently if there is no content?
Oct 23 2017