[Pas2js] resourcestrings structure

Michael Van Canneyt michael at freepascal.org
Thu Aug 8 08:14:10 CEST 2019



On Wed, 7 Aug 2019, warleyalex via Pas2js wrote:

> Creating my own alternative mechanism, of course, to translations strings. 
> Just curious, I can't find a way to generate similar JSON structure when
> using resourcestrings.

What is your question ?

The compiler creates the internal structure. You must follow this structure when
translating. How you get your translations, is entirely up to you.

I can say that when creating the "default" translation mechanism, 
I did not use the structure you are displaying below, because I think 
it makes no sense to have all languages loaded at the same time, 
it is a waste of memory.

Michael.


>
> var resources = {
>  'en_GB': {
>    translation: {
>      'menu': {
>        'Good bye': 'Good bye! $t(menu.country)',
>        'Hello': 'Hello! $t(menu.country)',
>        'Selectyourlanguage': 'Select your language: $t(menu.country)',
> 		'country': 'England'
>      }
>    }
>  },
>  'fr_FR': {
>    translation: {
>      'menu': {
>        'Good bye': 'Au revoir ! $t(menu.country)',
>        'Hello': 'Bonjour ! $t(menu.country)',
>        'Selectyourlanguage': 'SĂ©lectionner votre langage:
> $t(menu.country)',
>        'country': 'France'
>      }
>    }
>  },
>  'it_IT': {
>    translation: {
>      'menu': {
>        'Good bye': 'Arrivederci! $t(menu.country)',
>        'Hello': 'Buongiorno! $t(menu.country)',
>        'Selectyourlanguage': 'Seleziona la tua lingua: $t(menu.country)',
>        'country': 'Italy'
>      }
>    }
>  },
>  'br_BR': {
>    translation: {
>      'menu': {
>        'Good bye': 'Oi! $t(menu.country)',
>        'Hello': 'Olá! $t(menu.country)',
>        'Selectyourlanguage': 'Selecione seu idioma: $t(menu.country)',
>        'country': 'Brasil'
>      }
>    }
>  } 
> };
>
>
>
>
> --
> Sent from: http://pas2js.38893.n8.nabble.com/
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list