Adding True _() Syntactic Sugar to NGettext - #38
Conversation
|
Thank you for the PR but I'm afraid I can't accept it. It would be incompatible with COM/CLS (you even have a compiler warning suppression for that), but we need this to support some older platforms. But nice idea though. I didn't think about it. |
|
How married are you to complete CLS and COM compliance? One way to implement this, without destroying the COM/CLS compliance of the main NGettext package would be to add non-compliant wrapper DLLs that are targeted for a specific language (eg. NGettext.CS, NGettext.VB, etc.). |
|
Yeah and we're doing something like that already. Theoretically if you define proper precompiler directives to include this code only on modern targets, it will work.
|
This PR adds some syntactic sugar to the NGettext implementation.
It allows you to initialize and use a default Catalog that can then be accessed throughout your software by simply prefixing strings with
_()(no catalog object instance required)Contextual and Formatted strings are accessed by adding
cand/orfafter the_eg.
This behavior relies on
using static <fully qualified class name>The current implementation uses a static class, but it might be worth while to convert the static class into a singleton.
Unfortunately, I haven't been able to get the NGettext Solution to compile on my machine, however I have gotten this static class to compile in another project I was working on that uses the existing NGettext nuget packages, so while I am not going to give up on compiling it, I would like others to get a look at what I've done.