I tried to translate the interface of the notebook using gettext and faced with the need to make several changes to the source code:
1) List of files for internationalization: - data/extcode/notebook/templates/ (may not be used?): failed_login.template login.template register.template yes_no.template - devel/sage/sage/server/notebook/templates/ : account_recovery.html account_settings.html banner.html base.html base_authenticated.html docs.html error_message.html history.html list_top.html login.html registration.html search.html source_code.html template_error.html top_bar.html upload.html user_management.html worksheet_listing.html yes_no.html - devel/sage/sage/server/notebook/ : avatars.py cell.py colorize.py conf.py js.py mailsender.py notebook.py notebook_object.py register.py run_notebook.py sage_email.py sagetex.py smtpsend.py template.py tutorial.py twist.py user.py worksheet.py 2) At the beginning of each file in devel/sage/sage/server/notebook/ must specify the encoding UTF-8: # -*- coding: utf-8 -*- Config file for notebook, generated by function run() in file run_notebook.py also must have such encoding: config.write(""" # -*- coding: utf-8 - *- ### new addition #################################################################### 3) Function convert_seconds_to_meaningful_time_span() must be simplified, because in different languages differently shaped end of words that denote the seconds, minutes and hours, depending on the numerical value. For example, in Russian we must have different ends for 1, 2-4, 5-... (in English - only for 1, 2-...). The proposed simplification: def convert_seconds_to_meaningful_time_span(t): if t < 60: s = int(t) return "%d second(s)"%s if t < 3600: m = int(t/60) return "%d minute(s)"%m if t < 3600*24: h = int(t/3600) return "%d hour(s)"%h d = int(t/(3600*24)) return "%d day(s)"%d 4) TEMPLATE_PATH in template.py should contain an indication of the language catalog, e.g.: TEMPLATE_PATH = sage.misc.misc.SAGE_ROOT + '/devel/sage/sage/server/ notebook/en/templates' 5) Language selector (listbox) must be a part of the interface. 6) In local/notebook/javascript/tiny_mce/langs must be language packs for TinyMCE. The TinyMCE configuration, generated in cell.py (lines 199-213), must have one more parameter: language: "XX" "Stupid" (without gettext, directly changed files) Russian translation can be download from http://semerikov.googlepages.com/ru.tar.bz2 Unpack, copy, run 'sage -b' and try translated notebook. Screenshots: http://semerikov.googlepages.com/russian_sage_login.png and http://semerikov.googlepages.com/russian_sage_home.png I think that making language packs for notebook interface (and docs translation) will help to popularize Sage. I can also do the translation into Ukrainian, but I need in a language pack template for notebook (to easily add new languages as is done for the documentation). --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---