ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
176 stars 7 forks source link

Nimterlingua for i18n #42

Open juancarlospaco opened 5 years ago

juancarlospaco commented 5 years ago

https://moigagoo.svbtle.com/loco-localization-package-for-nim https://github.com/moigagoo/loco#loco-localization-package-for-nim https://moigagoo.github.io/loco/loco.html

Research and try the solution for potential inclusion on the future. Just 1 macro so should be easy to add. I can do Spanish. The idea is to move all strings into 1 file with Loco DSL. :thinking:

ThomasTJdev commented 5 years ago

It looks nice - I will try some testcases. Currently I'm using a hacked-up version.

juancarlospaco commented 5 years ago

Loco generates 1 proc for every string multiplied by every language, on namespace on runtime. :thinking:

This code:

import loco, macros

expandMacros:
  loco en:
    hello: "hello"

Produces this code at runtime:

import loco, macros, en

func hello(): string =
  result = "hello"

I coded this solution I think can be better: https://github.com/juancarlospaco/nim-nimterlingua#example

ThomasTJdev commented 5 years ago

Ohh, now my question ended up in the nimterlingua repo: https://github.com/juancarlospaco/nim-nimterlingua/issues/1