Add initial contributing information
CONTRIBUTING.md unknown status 1
| 1 | + | How to contribute? | |
| 2 | + | ================== | |
| 3 | + | ||
| 4 | + | Adding a system | |
| 5 | + | --------------- | |
| 6 | + | ||
| 7 | + | A system is a class in offlate/systems. It must implement at least these | |
| 8 | + | methods: | |
| 9 | + | ||
| 10 | + | ```python | |
| 11 | + | __init__(conf, name, lang, data = {}) | |
| 12 | + | ``` | |
| 13 | + | ||
| 14 | + | To initialise the object. `conf` is the global configuration object for this | |
| 15 | + | system. `name` is the name of the project and `lang` is the language to which | |
| 16 | + | the project is translated. Finally, `data` may contain additional information | |
| 17 | + | on the project. | |
| 18 | + | ||
| 19 | + | ```python | |
| 20 | + | open(basedir) | |
| 21 | + | ``` | |
| 22 | + | ||
| 23 | + | Implements the opening procedure for the project. `basedir` is the directory | |
| 24 | + | in which the project files are located. This method is called at the beginning | |
| 25 | + | of the application. | |
| 26 | + | ||
| 27 | + | ```python | |
| 28 | + | initialize(basedir) | |
| 29 | + | ``` | |
| 30 | + | ||
| 31 | + | Initialises a new project. `basedir` is the directory in which the project | |
| 32 | + | files are located. | |
| 33 | + | ||
| 34 | + | ```python | |
| 35 | + | update(callback) | |
| 36 | + | ``` | |
| 37 | + | ||
| 38 | + | Updates the project by connecting to the translation platform. `callback` is | |
| 39 | + | a procedure that can be called to resolve conflicts. This procedure looks like | |
| 40 | + | `callback(string_to_translate, local_translation, remote_translation)` and | |
| 41 | + | returns a translation for the string to translate. Note that the returned value | |
| 42 | + | might be different from the translations that were passed to it. | |
| 43 | + | ||
| 44 | + | ```python | |
| 45 | + | send(interface) | |
| 46 | + | ``` | |
| 47 | + | ||
| 48 | + | Sends the current state of the work to the platform, using `interface` as | |
| 49 | + | a way to ask more information to the user. | |
| 50 | + | ||
| 51 | + | ```python | |
| 52 | + | save() | |
| 53 | + | ``` | |
| 54 | + | ||
| 55 | + | Saves the current state of the work in the project's directory. This should | |
| 56 | + | be enough to resume work when the application is opened again and `open` is | |
| 57 | + | called. | |
| 58 | + | ||
| 59 | + | ```python | |
| 60 | + | content() | |
| 61 | + | ``` | |
| 62 | + | ||
| 63 | + | Retuns the content of the translation files, an object containing one field | |
| 64 | + | per project-resource. If the system doesn't have a notion of resource, the | |
| 65 | + | resource should be called "default". Each resource contains a list of `Entry` | |
| 66 | + | objects. | |
| 67 | + | ||
| 68 | + | Adding a format | |
| 69 | + | --------------- | |
| 70 | + | ||
| 71 | + | A format is represented by a class in offlate/formats. It must implement at | |
| 72 | + | least these methods: | |
| 73 | + | ||
| 74 | + | ```python | |
| 75 | + | init(files, conf) | |
| 76 | + | ``` | |
| 77 | + | ||
| 78 | + | Initialise the object. `files` is a variable whose meaning depends on the | |
| 79 | + | format. This variable is most likely an dictionnary containing a few fields | |
| 80 | + | whose values are filenames. `conf` is a configuration dictionnary for the | |
| 81 | + | format. | |
| 82 | + | ||
| 83 | + | ```python | |
| 84 | + | content() | |
| 85 | + | ``` | |
| 86 | + | ||
| 87 | + | Returns a list of Entry objects corresponding to the content of the files. | |
| 88 | + | ||
| 89 | + | ```python | |
| 90 | + | save() | |
| 91 | + | ``` | |
| 92 | + | ||
| 93 | + | Saves the list of Entry. |