jonforum Posted November 23, 2018 Share Posted November 23, 2018 Hi, what king of tool can allow me to manage a text dataBase in Json or javascript ? What the good practice and best way to manage this easily. Example in javascript , it little hard to read and find a message text reference. ! I am open to any suggestion and different approach. I thought I might be looking at Excel and with a JSON converter written in VBA maybe ? class _texts{ constructor(localisation) { localisation = localisation || 'frCa'; this.Conv_Q0I5a_0000 = { frCa:[ ], enUS:[ ], frFR:[ ], ru:[ ], }; this.Conv_Q0I5a_0001 = { frCa:[ ], enUS:[ ], frFR:[ ], ru:[ ], }; }; }; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 23, 2018 Share Posted November 23, 2018 Whatever you implement, make sure that Google Docs work with it jonforum 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted November 24, 2018 Author Share Posted November 24, 2018 20 hours ago, ivan.popelyshev said: Whatever you implement, make sure that Google Docs work with it thanks @ivan.popelyshev for tips, it solved now. so i will work in scv and with a regex parser. So for those who might be interested in the same subject. Since there is no subject related to that. here a nice ways.. make a sheets with tabs save in SCV and you will get this id;targetCode;frCA;enUS;ar;jp;ru;sp;;;;;; pancart_p1m1_01;0;Salut ceci est une exemple ${i.exp}. Voici l'astuce qui � ${test} Ce text est compatible es6. ;Hi This is an example ${i.exp}. Here's the trick that... ${test} this text is compatible es6.;????? ??? ?? ???? ???? ${i.exp}. ??? ?? ??????... ${??????} ??? ???? ?? es6 ???????.;??????????? ${i.exp} ????????????... ${test} ?????????????? es6?;?????? ??? ?????? ${i.exp}. ??? ????... ${?????????} ???? ????? ???????? ??????????? es6.;Hola este es un ejemplo, ${i.exp}. Aqu� est� el truco... ${prueba} este texto es compatible es6.;;;;;; ;1;ceci est un autre paragraphe, asigner a un personage suivant ! ;This is another paragraph, sign has a following character.;;;;;;;;;; ;;;;;;;;;;;;; ;;;;;;;;;;;;; ;;;;;;;;;;;;; ;;;;;;;;;;;;; demo_intro_b001;;;;;;;;;;;;; use or install a regex parser in your app ex: https://github.com/mholt/PapaParse and load CSV sheets ex: in pixiJS load_textsSCV(){ const loader = new PIXI.loaders.Loader(); loader.add('eventMessagesData', `data/eventMessage.csv`); loader.load(); loader.onProgress.add((loader, res) => { const dataParsed = Papa.parse(res.data); $texts.initializeFromData(dataParsed); }); loader.onComplete.add((loader, res) => { this._textsSCVLoaded = true; this.load() }); }; And here the final formated data parsed structure to use in your game. enjoys Quote Link to comment Share on other sites More sharing options...
mattstyles Posted November 25, 2018 Share Posted November 25, 2018 There are quite a few CSV to JSON converters and its almost always best to do it at compile time rather than run time. By doing it at runtime (as you're doing) you're asking the client to do more work every time, the CSV is probably larger than the corresponding JSON payload as well so you're adding bytes over the wire and as this example is translations presumably you're blocking your game/app from working until you have them so bytes are important. You're also sending every translation you have to everyone, in most cases this is extremely wasteful and would quickly become prohibitive. Many times you can use separate urls for different languages and only ship those translations that url (instance) needs. When you do need multiple languages in the same app/game, it might be worth loading one upfront, then loading the others if the user requests them, most of the time they won't, they certainly won't want all of them. So it probably best to have a process that takes your spreadsheet and converts it to the payloads you need and then just load (on the client) what you need. Pretty sure there are a number of different free tools that would do this sort of thing for you, and structure things like pluralisation and number handling for you also. The spreadsheet is a good starter, and it'll get you quite far, but there are better ways. For those interested in localisation it's worth googling i18n for several approaches. jonforum 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.