Commit Graph

3 Commits

Author SHA1 Message Date
jordi fita mas 7b1e17569e Add Gettext and GettextNoop to locale
xgettext does not recognize Get as marker for translatable strings, and
i can not add it as is because Go has many functions called Get, and it
would mark many strings as translatable that should not be, like HTTP
headers.

I believe that Gettext is unusual in Go, because the “correct” way to
spell that function in Go would be GetText, and would not interfere in
any other function.

GettextNoop is just a function that marks the string as translatable but
does not translate it at all.  I want this for error messages and such,
that i have to pass the string to a validator function, but it is only
necessary to translate it when the validation fails.  I doubt it makes
a difference in peformance, but still.
2023-07-24 17:09:43 +02:00
jordi fita mas 403c27f1e1 Add the skeleton of the web application
It does nothing more than to server a single page that does nothing
interesting.

This time i do not use a router.  Instead, i am trying out a technique
i have seen in an article[0] that i have tried in other, smaller,
projects and seems to work surprisingly well: it just “cuts off” the
URI path by path, passing the request from handler to handler until
it finds its way to a handler that actually serves the request.

That helps to loosen the coupling between the application and lower
handlers, and makes dependencies explicit, because i need to pass the
locale, company, etc. down instead of storing them in contexts.  Let’s
see if i do not regret it on a later date.

I also made a lot more packages that in Numerus.  In Numerus i actually
only have the single pkg package, and it works, kind of, but i notice
how i name my methods to avoid clashing instead of using packages for
that.  That is, instead of pkg.NewApp i now have app.New.

Initially i thought that Locale should be inside app, but then there was
a circular dependency between app and template.  That is why i created a
separate package, but now i am wondering if template should be inside
app too, but then i would have app.MustRenderTemplate instead of
template.MustRender.

The CSS is the most bare-bones file i could write because i am focusing
in markup right now; Oriol will fill in the file once the application is
working.

[0]: https://blog.merovius.de/posts/2017-06-18-how-not-to-use-an-http-router/
2023-07-23 00:11:00 +02:00
jordi fita mas 53347b0e80 Add Makefile to deploy with Sqitch and test with pg_prove
This is mainly intended for CI scripts, when building the distribution
package.
2023-07-22 23:56:16 +02:00