kkga / ter

A tiny wiki-style site generator with Zettelkasten flavor.
https://ter.kkga.me
MIT License
96 stars 6 forks source link

Add config option for locale date #18

Closed ghost closed 2 years ago

ghost commented 2 years ago

Is there a possibility for Ter to be translated to other languages? I can try to translate it to Portuguese, if at all possible.

kkga commented 2 years ago

Hmm I'm not sure what exactly the translation would be in this case. 99% of text on the pages is user's content. Can you give a specific example?

ghost commented 2 years ago

Yes, there are only a few strings that can be translated, like "Child pages" or "Child Tags". Since there aren't much more, perhaps this could be directly translated by the user in config.json? Also, the date format could be added as an option as well. What do you think?

kkga commented 2 years ago

Yeah I can provide options for these labels directly in the config file so that user can customize if needed.For the date it’s also possible to add a config option for locale so that dates are formatted accordingly: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

ghost commented 2 years ago

That's perfect, awesome :)

kkga commented 2 years ago

The date formatting should be configurable in the latest release. Here's the config example: https://ter.kkga.me/usage#options. For Portuguese you can use pt (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)

Let me know if it works as intended for you.

ghost commented 2 years ago

I can't seem to use Ter 0.8.0, I get this error:

error: Uncaught TypeError: Cannot convert undefined or null to object return handleCache(template, options)(data, options); ^ at Function.keys (<anonymous>) at eval (eval at compile (https://deno.land/x/eta@v1.12.3/compile.ts:24:16), <anonymous>:57:8) at render (https://deno.land/x/eta@v1.12.3/render.ts:90:42) at buildPage (https://deno.land/x/ter@0.8.0/build.ts:101:16) at buildContentFiles (https://deno.land/x/ter@0.8.0/files.ts:61:24) at async Promise.all (index 0) at async generateSite (https://deno.land/x/ter@0.8.0/main.ts:116:59) at async main (https://deno.land/x/ter@0.8.0/main.ts:216:3)

kkga commented 2 years ago

hmm... hard to say what went wrong here. Can you try running with -r flag to make sure it reloads all dependencies?

deno run -A -r --unstable https://deno.land/x/ter/main.ts
ghost commented 2 years ago

WHen I run that command, this happens:

error: Uncaught TypeError: Cannot convert undefined or null to object return handleCache(template, options)(data, options); ^ at Function.keys (<anonymous>) at eval (eval at compile (https://deno.land/x/eta@v1.12.3/compile.ts:24:16), <anonymous>:57:8) at render (https://deno.land/x/eta@v1.12.3/render.ts:90:42) at buildPage (https://deno.land/x/ter@0.8.0/build.ts:101:16) at buildContentFiles (https://deno.land/x/ter@0.8.0/files.ts:61:24) at async Promise.all (index 0) at async generateSite (https://deno.land/x/ter@0.8.0/main.ts:116:59) at async main (https://deno.land/x/ter@0.8.0/main.ts:216:3)

ghost commented 2 years ago

If run this command: deno run -A -r --unstable https://deno.land/x/ter@0.7.1/main.ts --serve
It works, both generating _site and --serve. But it does not work if I use "ter@0.8.0".

kkga commented 2 years ago

Is there any chance I can try debugging this with your content/config? Do you have a published site or a source git repo?

ghost commented 2 years ago

Sure, here: https://github.com/tiagojacinto/tgjcnt

kkga commented 2 years ago

Thanks for sharing. This was helpful as I found the issue.

I'll push an update soon, but in the meantime if you want to build a site with 0.8.0, just add an empty navigation object in the config.json:

{
  "navigation": {}
}
kkga commented 2 years ago

New release should work (without having to adjust config file): https://github.com/kkga/ter/releases/tag/0.8.1

Thanks 👍🏼

ghost commented 2 years ago

I confirm that it is working! Thanks!