Difference between revisions of "Student projects/Language editing interface"

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Student projects/Language editing interface.

(Comments & Suggestions: discussion link added)
(Shifted to dev docs)
Line 1: Line 1:
<p class="note">'''Note''': This page outlines ideas for the Web 2.0 language editing interface. It's a ''specification under construction''! If you have any comments or suggestions, please add them to the [[Talk:Student projects/Language editing interface|page comments]].''</p>
== Introduction ==
Moodle is [[Translation|designed to be translated]] into many languages, and currently has over 70 language packs.
The existing [[Language editing|language editing]] interface enables translators to check for untranslated words or phrases and also enables Moodle administrators to change words or phrases used in Moodle. However, it could really benefit from some improvements.
A brief overview of current implementation is given below:
* Moodle Language editing features allow you to edit different word, phrases in the Moodle interface and text in Help Documentation.
  - A language pack is a php file with a dictionary of variables containing representation of some string in another language.
  - Different strings can be accessed by calling function: get_string(string_to_find).
  - The English language pack is stored in /root/moodle/lang/ folder.
  - Language packs for other languages are stored in /moodledata/lang/xx_encoding/ for any language other than English.
  - When the files are edited from the website, variables in the base file are overlaid by variables in a new custom directory say /home/moodledata/lang/xx_encoding_local/
  - All these strings are stored in a variable called $strings[].
  - When the function get_string(...) is called with some string  as an argument, the function checks for the argument as key in the variable $strings. If a value is found, the value is returned otherwise false is returned.
* Project title: '''Web 2.0 language editing interface'''
* Student: '''Avi Mehta'''
* Mentors: David Mudrak, Petr Skoda (Skodak), Koen Roggemans
== Improvements Suggested (Overview) ==
* Improve the User Interface(Read: Inline editing, suggested translations etc. Suggestions welcome... ).
* Detect syntax errors and common problems in translated strings
* Include a search and replace feature for changing a particular word, for example the word "Course", in every language string
* Display the differences between local and parent language packs
* Spell checker
In addition, the project may also include:
* A local modification import/export feature
* Further language pack import improvements (Please use the comments to point out what you want to be fixed!!)
* Work on other long-standing language-related issues ( Comment!! and it might be included in the project ;) )
== Feature Details ==
This part lists some of the technical details.
=== Improve the User Interface (Inline Editing) ===
* Allow administrator to activate "In-place Translation" setting. The setting will allow administrator to specify users who can access the language editing feature.
** Once Activated, All pages will include two extra JavaScript files:
** One JavaScript Library File - To allow fast JavaScript implementation of common features, libraries are generally tested on multiple browsers and are considered to be pretty robust. I would suggest using jQuery but this can be discussed on.
** Custom JavaScript that forms the heart of this project. All steps below describe functionalities of this file.
- Provide simple "On", "Off" and "Save" buttons to allow users to start, stop the translation editing feature. The save button allows user to save all the modifications done at any point.
- When the feature is off, all pages render as they should be, to a simple user.
- When the feature is on, the JavaScript finds the current page, queries the server to find strings that can be localized and adds certain behaviors to the strings as described below.
- When the user hovers over the string, the string gets highlighted. This means that the string can be localized.
- To localize the string, User just needs to click on the string and the string is replaced by a textbox. User can type in the localized string.
- On pressing enter or on losing focus, the string gets saved in a local cache. The string is saved on the server whenever the user presses the save button next.
- To make the system usable, UI indicators would indicate that there are certain unsaved strings (example: Save button turns red when some unsaved strings exist. It stays green at other times).
* The server side modifications would include:
** Writing code to support JavaScript functionality. These will be a set of new pages that accept certain requests (like get localizable strings, save modified strings etc) via AJAX and use existing functions from admin/lang.php to generate output.
** Modifying the code to add certain markers to HTML so that localizable strings can be identified correctly.
=== Improve the User Interface (Translation Suggestions) ===
* Use Google Translate to automatically do a preliminary translation.
* The functionality of this extension would be:
  - Whenever the "On" Button is clicked on a page, In addition to contacting the server, js code also contacts Google servers to access translation API to get a preliminary version of the strings.
  - The preliminary strings are not shown to user by default. This is done so that user can look at the actual English string first. When the user clicks on the string, the preliminary string is shown to the user.
  - When the user saves the string, the result gets reflected on the page.
=== Display Differences between local and parent languagepacks ===
* This feature can nicely be integrated within the framework proposed for feature 1 by letting the user see a "wiki like" hierarchical history of string changes.
* This feature would require minor changes in the admin\lang.php file.
=== Spell Check ===
* Details to be decided
=== Search & Replace ===
* Details to be decided.
== Comments & Suggestions ==
Being a work in progress, We welcome all your suggestions, improvements and comments on anything detailed above. Please post comments on this page or in the Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97904 Language editing interface] forum discussion.
==See also==
*[http://code.google.com/soc/2008/moodle/appinfo.html?csaid=81375B3781E02C04 Web 2.0 language editing interface application abstract]
Last Modified: 05/23/2008

Latest revision as of 05:24, 15 September 2011

This development related page is now located in the Dev docs.

See the Student projects/Language editing interface page in the Dev docs.