Jump to content

text message dataBase and localisation manager


jonforum
 Share

Recommended Posts

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:[

            ],
        };
    };




};

 

Link to comment
Share on other sites

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
image.thumb.png.3df7a2a035c6691c121e55499b24601d.png

 

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.

image.thumb.png.b18c9a8a0c2b303ed6a35eeb1f68f082.png

 

enjoys

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...