digitalmars.D.learn - 2 question: internationalization and serialization
- Lloyd Dupont (30/30) Jun 01 2011 Hi I'm a newbie with big ambitions! (Sorry, got spoiled by C#)
- Lloyd Dupont (51/51) Jun 01 2011 I found half the answer to question 1 (internationalization)
- Jacob Carlborg (8/38) Jun 01 2011 For the serialization you could have a look at Orange:
- Lloyd Dupont (11/41) Jun 01 2011 Awesome! WIll take a look at it tonight!
- Lloyd Dupont (10/10) Jun 01 2011 I'm looking!
- Andrej Mitrovic (2/2) Jun 01 2011 You need mercurial and do 'hg clone
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (9/11) Jun 01 2011 Or you can just click on the "zip", "gz" or "bz2" button at the top
Anyhow I'm toying with a D learning project and there are 2 .NET feature that will be welcome in this D project: 1. internationalization. the app will contains a bunch of simple UIs and I was wondering how I would go on internationalizing the application. I.e. embed multiple "resource" for different languages in the EXE and show the appropriate ones for the target / running computer 2. I'd like a part of my library (in progress) to read / write some arbitrary settings. I was thing to use something akin to the DataContractSerialization we have in .NET where I could define a few classes with attribute [DataContract] class Root { [DataMember] public int Prop1 { get; set; } [DataMember] public B PropB { get; set; } } [DataContract] class B { [DataMember] public string Name { get; set; } } a reader / writer class can turn this class (using the atributes) into text (XML, JSON, I don't care) and back from text into object instance How would I implement something similar in D? Is there already a library doing it?
Jun 01 2011
I found half the answer to question 1 (internationalization) I still dunno how to get the local language (I guess I'll have to find the win32 method which return it) but I found how to do the resources!! (using mixins) what do you think? === D file === string[string][string] lang; mixin(import("lang.txt")); mixin(import("lang.fr.txt")); === lang.txt == lang["en"] = [ "start" : "start", "quit" : "quit", ]; === lang.fr.txt lang["fr"] = [ "start" : "demarrer", "quit" : "quitter", ]; ============ "Lloyd Dupont" wrote in message news:is5cs7$128p$1 digitalmars.com... Anyhow I'm toying with a D learning project and there are 2 .NET feature that will be welcome in this D project: 1. internationalization. the app will contains a bunch of simple UIs and I was wondering how I would go on internationalizing the application. I.e. embed multiple "resource" for different languages in the EXE and show the appropriate ones for the target / running computer 2. I'd like a part of my library (in progress) to read / write some arbitrary settings. I was thing to use something akin to the DataContractSerialization we have in .NET where I could define a few classes with attribute [DataContract] class Root { [DataMember] public int Prop1 { get; set; } [DataMember] public B PropB { get; set; } } [DataContract] class B { [DataMember] public string Name { get; set; } } a reader / writer class can turn this class (using the atributes) into text (XML, JSON, I don't care) and back from text into object instance How would I implement something similar in D? Is there already a library doing it?
Jun 01 2011
On 2011-06-01 14:51, Lloyd Dupont wrote:Anyhow I'm toying with a D learning project and there are 2 .NET feature that will be welcome in this D project: 1. internationalization. the app will contains a bunch of simple UIs and I was wondering how I would go on internationalizing the application. I.e. embed multiple "resource" for different languages in the EXE and show the appropriate ones for the target / running computer 2. I'd like a part of my library (in progress) to read / write some arbitrary settings. I was thing to use something akin to the DataContractSerialization we have in .NET where I could define a few classes with attribute [DataContract] class Root { [DataMember] public int Prop1 { get; set; } [DataMember] public B PropB { get; set; } } [DataContract] class B { [DataMember] public string Name { get; set; } } a reader / writer class can turn this class (using the atributes) into text (XML, JSON, I don't care) and back from text into object instance How would I implement something similar in D? Is there already a library doing it?For the serialization you could have a look at Orange: http://www.dsource.org/projects/orange Don't know if it works with the latest compilers, it's been a while since I updated the code. I'm also in the middle of complete rewrite of the library. At lease you can perhaps find some ideas. -- /Jacob Carlborg
Jun 01 2011
Awesome! WIll take a look at it tonight! Thanks for the link! :) "Jacob Carlborg" wrote in message news:is5msf$1lt0$1 digitalmars.com... On 2011-06-01 14:51, Lloyd Dupont wrote:Anyhow I'm toying with a D learning project and there are 2 .NET feature that will be welcome in this D project: 1. internationalization. the app will contains a bunch of simple UIs and I was wondering how I would go on internationalizing the application. I.e. embed multiple "resource" for different languages in the EXE and show the appropriate ones for the target / running computer 2. I'd like a part of my library (in progress) to read / write some arbitrary settings. I was thing to use something akin to the DataContractSerialization we have in .NET where I could define a few classes with attribute [DataContract] class Root { [DataMember] public int Prop1 { get; set; } [DataMember] public B PropB { get; set; } } [DataContract] class B { [DataMember] public string Name { get; set; } } a reader / writer class can turn this class (using the atributes) into text (XML, JSON, I don't care) and back from text into object instance How would I implement something similar in D? Is there already a library doing it?For the serialization you could have a look at Orange: http://www.dsource.org/projects/orange Don't know if it works with the latest compilers, it's been a while since I updated the code. I'm also in the middle of complete rewrite of the library. At lease you can perhaps find some ideas. -- /Jacob Carlborg
Jun 01 2011
I'm looking! mm... how do I download the repository!?! :~ "Jacob Carlborg" wrote in message news:is5msf$1lt0$1 digitalmars.com... For the serialization you could have a look at Orange: http://www.dsource.org/projects/orange Don't know if it works with the latest compilers, it's been a while since I updated the code. I'm also in the middle of complete rewrite of the library. At lease you can perhaps find some ideas. -- /Jacob Carlborg
Jun 01 2011
You need mercurial and do 'hg clone http://hg.dsource.org/projects/orange' from the command line.
Jun 01 2011
Andrej Mitrovic wrote:You need mercurial and do 'hg clone http://hg.dsource.org/projects/orange' from the command line.Or you can just click on the "zip", "gz" or "bz2" button at the top of http://hg.dsource.org/projects/orange if you do not care about the history. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jun 01 2011