[docs] [translate] fixes

This commit is contained in:
Rushabh Mehta 2013-07-23 15:36:29 +05:30
parent 013095fc06
commit cab139c150
4 changed files with 338 additions and 2 deletions

95
docs/docs.about.md Normal file
View File

@ -0,0 +1,95 @@
---
{
"_label": "About ERPNext"
}
---
ERPNext is a web based, open source ERP for small, medium sized businesses. Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Built on Python / MySQL. ERPNext also contains a CMS (Content Management System) to generate a website and webshop.
Published by [Web Notes Technlogies Pvt Ltd, Mumbai](https://erpnext.com/about).
- [User Guide](https://erpnext.org/docs.user.html)
- [Getting Help](https://erpnext.org/docs.user.help.html)
- [Developer Forum](http://groups.google.com/group/erpnext-developer-forum)
- [User Forum](http://groups.google.com/group/erpnext-user-forum)
- [Donate](https://erpnext.com)
---
### Download and Install
##### Virtual Image:
- [ERPNext Download](http://erpnext.com/erpnext-download)
##### On Linux:
1. Switch to root user using `sudo su`
1. create a folder where you want to install erpnext
1. go to the new folder
1. `wget https://raw.github.com/webnotes/erpnext/master/install_erpnext.py`
1. `python install_erpnext.py`
[See installation notes](https://github.com/webnotes/erpnext/wiki/How-to-Install-ERPNext)
##### Patch and update
To patch and update from the latest git repository the erpnext folder and run.
You will have to set your origin in git remote
$ lib/wnf.py --update origin master
---
## License
GNU/General Public License (see LICENSE.txt)
The ERPNext code is licensed as GNU General Public License (v3) and the Documentation is licensed as Creative Commons (CC-BY-SA-3.0) and the copyright is owned by Web Notes Technologies Pvt Ltd (Web Notes).
### Copyright for Contributors
Unless otherwise asserted in the code files, Web Notes will own the copyright of all contributions too. That means Web Notes holds the rights to change the license in the future or offer Commercial Licenses.
Web Notes will only accept copyright assertions in case of a significant contribution like a whole new functionality or a major rewrite. We believe if your contribution is significant then you should have a say in what license Web Notes selects in the future and/or have a right to any revenue Web Notes gets from a Commercial License. Either ways Web Notes will have the right to decide what is a "significant" contribution.
Note: At the moment, Web Notes does not give Commercial License for ERPNext nor has specific plans do so in the future.
---
## Logo and Trademark
The brand name ERPNext and the logo are trademarks of Web Notes Technologies Pvt. Ltd.
### Introduction
Web Notes Technologies Pvt. Ltd. (Web Notes) owns and oversees the trademarks for the ERPNext name and logos. We have developed this trademark usage policy with the following goals in mind:
- Wed like to make it easy for anyone to use the ERPNext name or logo for community-oriented efforts that help spread and improve ERPNext.
- Wed like to make it clear how ERPNext-related businesses and projects can (and cannot) use the ERPNext name and logo.
- Wed like to make it hard for anyone to use the ERPNext name and logo to unfairly profit from, trick or confuse people who are looking for official ERPNext resources.
### Web Notes Trademark Usage Policy
Permission from Web Notes is required to use the ERPNext name or logo as part of any project, product, service, domain or company name.
We will grant permission to use the ERPNext name and logo for projects that meet the following criteria:
- The primary purpose of your project is to promote the spread and improvement of the ERPNext software.
- Your project is non-commercial in nature (it can make money to cover its costs or contribute to non-profit entities, but it cannot be run as a for-profit project or business).
Your project neither promotes nor is associated with entities that currently fail to comply with the GPL license under which ERPNext is distributed.
- If your project meets these criteria, you will be permitted to use the ERPNext name and logo to promote your project in any way you see fit with one exception: Please do not use ERPNext as part of a domain name.
Use of the ERPNext name and logo is additionally allowed in the following situations:
All other ERPNext-related businesses or projects can use the ERPNext name and logo to refer to and explain their services, but they cannot use them as part of a product, project, service, domain, or company name and they cannot use them in any way that suggests an affiliation with or endorsement by the ERPNext or WebNotes or the ERPNext open source project. For example, a consulting company can describe its business as “123 Web Services, offering ERPNext consulting for small businesses,” but cannot call its business “The ERPNext Consulting Company.”
Similarly, its OK to use the ERPNext logo as part of a page that describes your products or services, but it is not OK to use it as part of your company or product logo or branding itself. Under no circumstances is it permitted to use ERPNext as part of a top-level domain name.
We do not allow the use of the trademark in advertising, including AdSense/AdWords.
Please note that it is not the goal of this policy to limit commercial activity around ERPNext. We encourage ERPNext-based businesses, and we would love to see hundreds of them.
When in doubt about your use of the ERPNext name or logo, please contact the Web Notes Technologies for clarification.
(inspired from Wordpress)

177
docs/docs.dev.api.md Normal file
View File

@ -0,0 +1,177 @@
---
{
"_label": "ERPNext API"
}
---
All communication with the ERPNext server happens via web services using HTTP requests and passing data via JSON (Javascript Object Notation). Using web requests you can insert, update, query, run public triggers etc. The basic scheme is as follows:
1. All API calls are to me made to `server.py` on your public folder of your erpnext account. For hosted users, it is (yourdomain.erpnext.com).
1. The `cmd` parameter points to the python function to be executed.
1. Authentication is managed using cookies.
### Authentication
Authentication is done via the login method:
GET server.py?cmd=login&usr=[username]&password=[password]
The login method returns a session id `sid` cookie in the header and a status in the
body of the request. The `sid` cookie must be sent for each subsequent request.
Example:
$ curl -I http://localhost/webnotes/erpnext/public/server.py?cmd=login\&usr=Administrator\&pwd=admin
HTTP/1.1 200 OK
Date: Tue, 23 Jul 2013 05:29:24 GMT
Server: Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r
Set-Cookie: country=None
Set-Cookie: sid=d0ce00d49c24869984960607a2467b50ff59b0024741922db4b23818; expires=Fri, 26 Jul 2013 10:59:25
Content-Length: 32
Content-Type: text/html; charset: utf-8
{"message":"Logged In","exc":""}
$ curl http://localhost/webnotes/erpnext/public/server.py?cmd=webnotes.client.get\&doctype=Profile\&name=Administrator -b sid=d0ce00d49c24869984960607a2467b50ff59b0024741922db4b23818
{
"message":[
{
"user_image":null,
"last_name":"User",
"last_ip":"::1",
..
..
### Python Remote Client
You can use the `webclient.py` module as an example of how to access data using the webservice API
- [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/utils/webclient.py)
- [Docs](http://erpnext.org/docs.dev.framework.server.webnotes.utils.webclient.html)
### Passing and Receiving Documents (`doclist`)
To insert or update documents in ERPNext you have to pass them as a JSON Object. The structure of a Document is a list of plain objects (called `doclist`). The `doclist`
contains the the parent document and any child documents (if they are present).
Example:
[{
"doctype": "Parent"
"key1": "value1"
..
},{
"doctype": "Child",
"parenttype": "Parent",
"parentfield": "children",
"key1", "value1",
..
}]
### webnotes.client
`webnotes.client` is the easiest way to interact with the ERPNext Server. It contains
a bunch of server-side public methods that can be used by any client.
- [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/client.py)
- [Docs](http://erpnext.org/docs.dev.framework.server.webnotes.client.html)
### Example
Here is an example how you can use the webclient module to insert a new Sales Invoice
in ERPNext.
from webclient import *
server = "http://myaccount.erpnext.com/server.py"
user = "your user name"
password = "your password"
login()
customer = get_doc("Customer", customer_name)
# make customer if required
if not customer:
response = insert([{
"doctype":"Customer",
"customer_name": customer_name,
"customer_type": "Company",
"customer_group": "Standard Group",
"territory": "Default",
"customer_details": "some unique info",
"company": "Alpha"
}])
# make invoice
resonse = insert([
# main
{
"naming_series": "_T-Sales Invoice-",
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
"debit_to": "_Test Customer - _TC",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"doctype": "Sales Invoice",
"due_date": "2013-01-23",
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 561.8,
"grand_total_export": 561.8,
"net_total": 500.0,
"plc_conversion_rate": 1.0,
"posting_date": "2013-01-23",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"territory": "_Test Territory"
},
# items
{
"amount": 500.0,
"basic_rate": 500.0,
"description": "138-CMS Shoe",
"doctype": "Sales Invoice Item",
"export_amount": 500.0,
"export_rate": 500.0,
"income_account": "Sales - _TC",
"cost_center": "_Test Cost Center - _TC",
"item_name": "138-CMS Shoe",
"parentfield": "entries",
"qty": 1.0
},
# taxes
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"tax_amount": 30.0,
},
{
"account_head": "_Test Account Service Tax - _TC",
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"tax_amount": 31.8,
},
# sales team
{
"parentfield": "sales_team",
"doctype": "Sales Team",
"sales_person": "_Test Sales Person 1",
"allocated_percentage": 65.5,
},
{
"parentfield": "sales_team",
"doctype": "Sales Team",
"sales_person": "_Test Sales Person 2",
"allocated_percentage": 34.5,
},
)]

View File

@ -1,13 +1,13 @@
---
{
"_label": "Developer API",
"_label": "Developer",
"_toc": [
"docs.dev.install",
"docs.dev.quickstart",
"docs.dev.framework",
"docs.dev.api",
"docs.dev.modules",
"docs.dev.translate",
"docs.dev.translate"
]
}
---

View File

@ -0,0 +1,64 @@
---
{
"_label": "ERPNext Translations"
}
---
This document shows how to translations are managed in ERPNext and how to add a new language or update translations of an existing language.
### Source
Translatable text exists in 3 main sources:
1. Javascript Code Files (both framework and application)
1. Python Code Files
1. DocTypes (names, labels and select options)
#### Strings in Code Files
Strings in code files are annotated using the `_` (underscore) method
1. In Python it is the `webnotes._` method. Example:
webnotes._("This string must be translated")
1. In Javascript it is the `wn._` method. Example:
`wn._("This string must be translated")`
### How Translations Are Picked up During Execution
When the __build__ (`lib/wnf.py -b`) process is run, along with generating the `public` folders, it will also add a `locale` folder in each folder where translations need to be applied. This `locale` folder is rebuilt every time new translations are made.
Based on the user preferences or request preferences, the appropriate translations are loaded at the time of request on the server side. Or if metadata (DocType) is queried, then the appropriate translations are appended when the DocType data is requested.
The underscore `_` method will replace the strings based on the available translations loaded at the time.
### Master Translations
Master translations are stored in the application (erpnext repository) in the `translations` folder. [Translations master folder](https://github.com/webnotes/erpnext/tree/master/translations)
These are built using the `webnotes.translate module` ([Docs](http://erpnext.org/docs.dev.framework.server.webnotes.translate.html) | [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/translate.py)).
### Building Translations
Translations can be built using the `lib/wnf.py` utility. Do `lib/wnf.py --help` for more info.
> New translations are built using Google Translate API. As of the time of writing of this document, Google Translate API is not free. To build a translation of your own from Google, you will have to register with Google API and add your API key in `conf.py`
To add a new language just add:
1. Build new translation from Google: `lib/wnf.py --translate ru`
1. Get user the ability to select this language: Go to #Form/DocType/Profile and update the options in `langauge` field.
1. Map the language name to the abbreviation: Update `startup/__init__.py` ([Link](https://github.com/webnotes/erpnext/blob/master/startup/__init__.py))
### Updating Translations
#### Updating Sources:
If you find translatable strings are not properly annotated using the `_` method, you can add them in the code and rebuild the translations.
#### Improving Translations:
To improve an existing translation, just edit the master translation files in `app/translations` and rebuild using `lib/wnf.py -b`
> Please contribute your translations back to ERPNext by sending us a Pull Request.