quasalang
quasalang copied to clipboard
Code parse and automatic CSV builder
My propose is this. When one make app use something like this
$t(':::This is my key')
$t('thi-is-my-key:::Thi is my key text')
The idea is that when you create your app you do not think about saving keys in CSV you just place :::
in your text. Later you run command
quasalang parse
This will parse all documents and look for /\$t\(("|')([.]*)?:::([.]*)("|')\)/
. Something like this nod exactly. But it will look all $t function with :::
in a string. When it finds :::And then text
it created key from text and-then-text
and save in CSV key and english translation, and content ot $t
in the code change to key.
Before parse $t(':::This is my key')
, after parse $t('this-is-my-key')
and this-is-my-key = This is my key
in CSV.
Before parse $t('short-key:::Very long text')
, after parse $t('short-key')
and short-key = Very long text
in CSV.
I did that on a number of projects already and I'll be happy to share is approved.