How to handle i18n in Go? - internationalization

I searched on web but I didn't find anything related to i18n and Go.
I wish to use Go for develop web sites. What is the best way to handle internationalization?

go-i18n has some nice features:
Implements CLDR plural rules.
Uses text/template for strings with variables.
Translation files are simple JSON.

Packages roadmap
Comprehensive support for international text.
Support for international dates, times, etc.
Support for multilingual messages.
As you can see from the Go Roadmap, Go doesn't provide full i18n support yet.

The new template package allows you to at add a function to template's function map, that would transform the given string to a localized version. What's going on underneath would be up to you for now, as the language choice could be based on headers sent by the browser.
That's a very basic use case for adding localized messages in a web app, for one.
Can't wait for the proper support for internationalization, local date and time formats.

Related

Algolia style API documentation

I really like the way Algolia has approached their multi-programming language API documentation, e.g. https://www.algolia.com/doc/javascript .
Does some know by chance what technologies do they use to generate it?
The documentation generator we're using is currently an internal tool. We might open-source it at some point, but it would require some extra work time which we don't currently have.
It's basically a markdown file with some extra syntax to:
handle multiple languages code blocks (it then automatically selects the good one)
handle conditions depending on the current language
handle callouts
handle buttons
The rendering is then hand-made with the help of bootstrap.

Ajax validation for Go programs

Is there a Go package that supports data validation for restful apis?
It would be good if there were something similar to active model validation in Ruby?
I tried various ways but couldn't find something that offers good abstration of this need.
go-validator has support for tags and custom validators on top of the built-in ones. It can easily be added to the models for your API resources.

Overriding i18n Messages to use database Play framework

In my company they tend to ask some extremly weird features, they want me to load dynamic language files, is there a way to solve this issue without having to rewrite the whole Messages provider of play framework, and instead use some files stored somewhere on the server to handle internationalization?
this could save me a month of work because i've already wrote a huge application (been working on it for a year now) and they want to make all the labels customizable by client.
any help, or any suggestions?
i'm using play framework latest version.
Sadly there is not really much customization options in the Messages API. One idea that might work is to subclass MessagesPlugin with a custom implementation of the api method and provide strings from the database there and then register that as a plugin in your app.

Customize application for different customers

Based on a specific application (bakery ERP), I need to create a new branch as a general purpose ERP with basic functionality (invoices, orders, work orders, customer communications...).
This new branch must be customizable for each client: print formats, application colors and icons/images, and restricted access to some application parts...
I've read about resource files for text/icons/image customization, but I need some help or alternatives, maybe defining an Interface to provide needed resources.
I use DevExpress components, so, print formats, and forms layout can be customized storing formats and layouts in files. However, main form has to be completely redesigned, and i wonder about the best way to do this. ¿this can be done with a little project containing the main form and implementing an interface providing custom images for buttons and other customizations?
Apart from layout customization, I need to restrict access to some parts of ERP for each customer, but behavior customization will be minimal or nonexistent, so, maybe I can personalize behavior with an xml config file for each customer.
Independently of my ideas, I thank you for any idea or comment about mu purpose: interface customization for each client, and minimal behavior customization. Don't need complex solutions like Workflow Foundation or completely pug-in based development.
If it's only format of prints and screen images, just use resource files or database configurations.
If you need functionality to be changed - use interfaces and inject their implementation via some framework, like MEF, for example.
And your English is good, no need to sorry

Get at tags for blog posts programmatically

I wonder how to get at tags in blog posts (WordPress, Blogger, or Blogspot) programmatically (API, RSS feed, XML, other methods). Preferably a solution usable in Ruby on Rails.
See what the life streaming Rails apps such as kakuteru are using. Tagging across multiple Web2.0 style streams is important to kakuteru and I think they may employ a number of techniques. The also employ zemanta which has an API to generate tags from content. You can see zemanta's example of getting tags using ruby
If either of those have an API, i'd start by reading their documentation; outside of that; you can roll your own screenscraper (which is likely to be useless, given the amount of DOM content that is script generated these days)
Wordpress API
Blogger API

Resources