Changes between Version 5 and Version 6 of BluePrint/Translation

03/18/12 10:01:14 (10 years ago)



  • BluePrint/Translation

    v5 v6  
    44Sahana Eden uses the translation features of web2py. For the application programmer this requires the use of the function T() when displaying strings which will be displayed on the screen and so will need to be translated. The core web2py translation functionality extracts the strings and stores them in a *.py file, unfortunately this file only has space for the original and the translated string. For the translator it is often helpful to have a comment that can explain the context of a particular phrase. For other features to be introduced as part of this work it would also be necessary to know the origin of the string, this would be the file and possibly also the line number. (Note the sting may have more than one origin, i.e. it appears in the code in more than one place).
     7Currently the strings for translation are held in a *.py file in the languages directory. To test this you can create a '''new''' language (see deployment_settings.L10n.languages) create an empty file in the languages directory and then visit a few Sahana-Eden pages having selected the '''new''' language. Now go back to the code and see that the file has been populated with some new strings.
     9The extracted strings with location could be held in a temporary place different from the languages file. This could be a plain file or possibly a database. Extra data that would be useful to retain here would be:
     10 * the location,
     11   * file name
     12   * line number
     13 * any comment to the translator,
     14 * translation status,
     15 * date of extraction,
     16 *
    617== Changes to the core translation functionality ==
    7 The standard web2py function should be extended to support an optional comment, ideally this would be done with the call to T() but an alternative solution may be acceptable.
     18The standard web2py function should be extended to support an optional comment, ideally this would be done with the call to T() but an alternative solution may be acceptable. Note what we don't want to have to do unless absolutely necessary (and even then we don't want to do it) is to have to change either the name of the function or the required parameters, because that would require numerous changes within the existing code base. So the comment ''could'' be an optional parameter but the function must use reflection techniques to work out it's own location.
    920When an instance of Sahana-Eden is deployed it may require translation, if this is during an emergency there may not be a lot of time and so only a select subset of strings need to be translated. This subset might be the front facing part of the deployment or it may include just the modules that have been deployed. However, when the files for translation are created there is no link back to the code and so it is difficult to know where the string came from. What is required is for the function to extract the location of the string this can then be used to determine which module the string belongs to. This functionality may have several iterations but with the final goal of being able to download strings for translation that belong to various modules, this might involve a UI that allows the translation administrator to select which modules (or parts) of the system they want to translate.
    2132Once the strings for translation have been identified then the UI needs to provide a seamless mechanism to integrate them back into Sahana-Eden.
     34== Priority ==
     35This is purely indicative and may change
     36 * Being able to extract details concerning where a string is located within the code base
     37 * Automate the translation round-trip (initial focus on the spreadsheet approach rather than pootle)
     38 * Build a GUI front end to present the translation status
     39   * Extract for a module or set of modules (ideally this will be generated without having to page through Eden web pages)
     40   * Report on the translation status (percentage translated per module)
     41   * Display and edit translation strings (optional but can be useful if translators have questions about a particular string and probably design here but implement later)
     42   * Identify roles (translation manager, translator...)
     43 * Allow comments to be added to the T() function and let translators indicate when comments would be useful. ''Possibly consider adding these dynamically to the code base''
     44 * Validate the translations and original strings for fitness (this will require some investigation on what this could entail one idea would be to ensure that %s variable substitutions are properly labeled.
     45 * more to come...
    2346== Technical help ==
    24 For the translation process see the chapter in the book on [ Localisation]
    25 For the translation code see {{{web2py/gluon/}}}
     47 * For the translation process see the chapter in the book on [ Localisation]
     48 * For the translation code see {{{web2py/gluon/}}}
     49 * For translating to and from a spreadsheet see the [ Translate Toolkit], also mentioned in the Eden book. (versions are packaged for .deb and .rpm just search for translate-toolkit within your package manager)
     50 * The survey application uses it's own translation so that the survey forms can be translated independent of the application. Check the code for this {{{eden/applications/modules/eden/}}}