Hi! I’m using Ocsigen to build a website and got to the point where it makes sense to have several languages. I started to experiment with the ocsigen-i18n with a simple example. For that I created the TSV file and the makefile.i18n (based on the on in ocsigen-start example) and in the makefile.options I added the following information:
I18N_LANGUAGES := en,pt
I18N_DEFAULT_LANGUAGE := pt
I18N_TSV_FILE := assets/$(PROJECT_NAME)_i18n.tsv
When trying to use [%i18n foo] I get the error Uninterpreted extension ‘i18n’. Am I missing some information I should be adding to my project?
Thank you very much in advance.
Default makefile from Ocsigen Start should add all the PPX options for you.
i18n syntax is avalaible only in
.eliom files, not in
.ml. Is it your problem?
Thank you for your answer. I’m using an Eliom file with only the following information:
module Mysite_app =
let application_name = "mysite"
let global_data_path = None
let main_service =
let () =
(fun () () ->
h1 [%i18n welcome_text1];
If I use the Makefile.option provided by the Ocsigen-start and change the line h1 [%i18n welcome_text1] to h1 [txt “Hello”] I get the error:
Error (warning 31): files _client/mysite_i18n.cmo and _client/mysite_i18n.cmo both define a module named Mysite_i18n
I don’t know if this has anything to do with the problem. Also, it may be important to add that I created the project as a basic one (not as ocsigen-start) and started to add the necessary information to it.
Thank you very much.
The basic distillery template does not have i18n support by default I think. You probably have more changes to do in the makefiles to use the syntax extension. Take Ocsigen Start template as example.
When you compile an OS project, you have somthing like
eliomc ... -ppx "ocsigen-i18n-rewriter Mysite_i18n"
(And it seems module mysite_i18n is linked twice, which is wrong.)
If you want to learn or if you want an application with user management, I recommend to use Ocsigen Start’s template. It is well tested and will save you a lot of time.
Thank you very much for your answer.
I was using the basic template but made changes to the Makefile.option, to include more packages (using Ocsigen-start template as an example). I will try and understand why it is linking the module twice. I will also take a more careful look at Ocsigen-start to better understand the i18n implementation.
Thank you again.