Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 23, 2017 Dynamically import() 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é |
October 23, 2017 Re: Dynamically import() files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Pany | 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. |
October 23, 2017 Re: Dynamically import() files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Pany | 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?
|
October 24, 2017 Re: Dynamically import() files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Igor | 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:
>> 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?
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é
|
Copyright © 1999-2021 by the D Language Foundation