Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.51k stars 67 forks source link

Localization string engine #214

Open CymDeveloppement opened 1 week ago

CymDeveloppement commented 1 week ago

as described in this guide : http://pgas.freeshell.org/mirror/ABSlocalization.html localization is possible with dollar sign before double quotes

cd $var || error $"Can't cd to %s." "$var"
read -p $"Enter the value: " var

maybe amber can add this sign easily.

this may make it possible in the future to generate translation files easily directly with Amber or with integrated function

CymDeveloppement commented 1 week ago

or it can be made explicit with a special sign before the double quotes

Ph0enixKM commented 1 week ago

@CymDeveloppement this is a good question. We could have a special syntax for that local "Hello World" or something similar.

CymDeveloppement commented 1 week ago

@Ph0enixKM i think a explicit keyword like "local" is a good way

b1ek commented 1 week ago

shouldn't this kind of thing be done on a library level?

Ph0enixKM commented 1 week ago

shouldn't this kind of thing be done on a library level?

Good question. Adding blindly new keywords and built-ins will increase the learning curve of this language. This is why it actually would be better as an stdlib function. You're right @b1ek.

b1ek commented 1 week ago

Adding blindly new keywords and built-ins will increase the learning curve of this language

it will just make it an unstructured mess imo

Mte90 commented 1 week ago

Maybe we can start a new repo with libraries in pure Amber and when that function can be imported in the Amber language.

Like for https://github.com/Ph0enixKM/Amber/issues/218, in this way in Amber we add builtin the most basic stuff and for other exotic they get like a review process and a different usage.

So maybe it's time to create a Github organization for the various repositories?