Role name translation

44 views
Skip to first unread message

Y Y

unread,
Aug 25, 2014, 8:31:23 PM8/25/14
to erpnext-dev...@googlegroups.com
Dear Team,

I've got frustrated at role translation, as those are in database tables records.

Thus i've prepared script to update: user, role, perm, page role table. those i think i'm doing correct.

However, after apply...:
1. Setup a new site, in the end, it looks for "System  Manager", oops, it can't be translated...
2. Then i keep "System Manager" as it is, then in HR module, create a new employee
    2.1 It prompts that need a role "Leave Approver" which i've already translated. Thus...
    2.2 After assign employee an user account, then save, it says, can't find role "Employee"


Any advice on how to translate the roles?

Thanks,
Yang
 

Y Y

unread,
Aug 25, 2014, 9:52:14 PM8/25/14
to erpnext-dev...@googlegroups.com
Extra information, in tabRole table, there is name, and role_name, I'm thinking is that only need to translate role_name. 

Then only 1 fix need to made is source code for: desk#permission-manager
only the role select box use both "name" field as select's name and value, in this case, the name shall be "name" field, value shall use "role_name" field

is this correct? if yes, i can create a pull request for this change.

Thanks.

在 2014年8月26日星期二UTC+8上午8时31分23秒,Y Y写道:

Y Y

unread,
Aug 25, 2014, 11:16:39 PM8/25/14
to erpnext-dev...@googlegroups.com
well, i think the correct way is to add those into csv... yes, for those roles.

There are still places need to do translation, say permission_manager.js:
<i class="icon-refresh"></i> Restore Original Permissions</button>'), the Button name didn't use __()

the table which shows metrics of document type, role, permission, still not use __(), this part maybe more complex, as it use ajax to store the mapping to database, if translated, will it fail...?

thanks, i'm glad to contribute then send pull request, please let me trick if there is, it will save many effort.

Best Regards,
yang

在 2014年8月26日星期二UTC+8上午9时52分14秒,Y Y写道:

Anand Doshi

unread,
Aug 26, 2014, 1:29:54 AM8/26/14
to ERPNext Developer's Forum
Hi Yang,

Putting the text in __() should solve the issue.

-Anand.


--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/ee7d55fe-8b44-4070-b9c2-9861111f6321%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Y Y

unread,
Aug 26, 2014, 2:24:55 AM8/26/14
to erpnext-dev...@googlegroups.com
Hi Anand,

I would like to send pull request after done testing at myside, do i need to create issue in Github first?

Another important translation issue due to culture, it happens to every list when no result found.

currently, seems implements like __("no") + __("master") + __("found"). which is okay in english, however, in our country's translation, will be very strange.

you may already noticed that "no" is already used in select box(yes no), thus, for this, it is just use common word "No Record Found", then i will standardized across country.

Thanks,
Yang

在 2014年8月26日星期二UTC+8下午1时29分54秒,Anand Doshi写道:
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

unread,
Aug 26, 2014, 4:53:24 AM8/26/14
to ERPNext Developer's Forum
Hi Yang,

You can change it to:

__("No {0} found", [variable])

You can send us a pull request without an issue. :)

Thanks,
Anand.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/5f85d49b-ce88-4dd7-ad9d-a8f57d1e1bd6%40googlegroups.com.

Y Y

unread,
Aug 26, 2014, 5:18:41 AM8/26/14
to erpnext-dev...@googlegroups.com
Noted. thanks,

as i'm working on permission_manager.js, i feel strange why my work doesn't work. i added"
console.log(fieldname+ ": " + __(fieldname)); //suppose to show translation

i added translation for: read, write

then in browser console, it shows:
read: read VM4346:193
write: write

is there any trick command need to execute?

在 2014年8月26日星期二UTC+8下午4时53分24秒,Anand Doshi写道:
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Aug 26, 2014, 5:31:53 AM8/26/14
to erpnext-dev...@googlegroups.com
On 26-Aug-2014, at 2:48 pm, Y Y <yangy...@gmail.com> wrote:

Noted. thanks,

as i'm working on permission_manager.js, i feel strange why my work doesn't work. i added"
console.log(fieldname+ ": " + __(fieldname)); //suppose to show translation

i added translation for: read, write

then in browser console, it shows:
read: read VM4346:193
write: write

is there any trick command need to execute?


When the page "permission_manager" is loaded, it should automatically append the related translations in the JSON object. can see the REQUEST and check if this happens.

Also run "frappe --clear_cache" before after you update the translation files. translations are memcached after they are read.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1f79b8d4-26a6-41f8-85a2-0934eea480fb%40googlegroups.com.

Y Y

unread,
Aug 26, 2014, 6:01:32 AM8/26/14
to erpnext-dev...@googlegroups.com
Tried command frappe --clear_cache, translation still not shown.

Also checked the json you mentioned, i can see it stores in local storage, copied and pasted to editor, the translation is in 
"$.extend(frappe._messages, {\"Level 0 is for document level permissions, higher levels for field level permissions.\": \"0\\u7ea7\\u662f\\u6587\\u6863\\u7ea7\\u6743\\u9650\\uff0c\\u66f4\\u9ad8\\u5c42\\u6b21\\u4e3a\\u5b57\\u6bb5\\u7ea7\\u6743\\u9650\\u3002\", \"Did not add\": \"\\u6dfb\\u52a0\\u5931\\u8d25\",

etc. However my new added translation for read, write etc. are not there.

Please advise how to fix and check, i can see pull request.

Thanks,
Yang 


在 2014年8月26日星期二UTC+8下午5时31分53秒,rushabh写道:

Anand Doshi

unread,
Aug 26, 2014, 6:25:13 AM8/26/14
to ERPNext Developer's Forum
Yang.

Could be an issue. Let me check and confirm after sometime.

-Anand.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c60978a4-9baa-4f87-a82d-e8f07eb878dc%40googlegroups.com.

Y Y

unread,
Aug 26, 2014, 6:27:54 AM8/26/14
to erpnext-dev...@googlegroups.com
Thanks Anand,

By the way, i apply "No {0} found" locally, due to my translation doesn't work, i will pend send pull request until test success locally.

You guys are awesome.

Best Regards,
Yang

在 2014年8月26日星期二UTC+8下午6时25分13秒,Anand Doshi写道:

在 2014年8月26日星期二UTC+8下午5时31分53秒,rushabh写道:

在 2014年8月26日星期二UTC+8下午4时53分24秒,Anand Doshi写道:

--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Aug 26, 2014, 6:51:17 AM8/26/14
to erpnext-dev...@googlegroups.com
On 26-Aug-2014, at 3:57 pm, Y Y <yangy...@gmail.com> wrote:

Thanks Anand,

By the way, i apply "No {0} found" locally, due to my translation doesn't work, i will pend send pull request until test success locally.

If you open your pull-request now, we can help you debug.


You guys are awesome.

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4cb4ee3e-6726-441d-b038-db384097c19f%40googlegroups.com.

Y Y

unread,
Aug 26, 2014, 9:11:42 AM8/26/14
to erpnext-dev...@googlegroups.com
Created. You shall be able to see pull request from 81552433qqcom user.

Just notes:
1. not sure "read" "Read" will look for same translation or not?(translation key is case-sensitive, right?)
2. even though it is true for case 1, i've added read, write(small case)'s translation in my zh-cn.csv(didn't commit, as not a finished one), if your side need test, you can do against any translation file(manually added into csv).

Thanks.
Yang

在 2014年8月26日星期二UTC+8上午8时31分23秒,Y Y写道:

Y Y

unread,
Aug 26, 2014, 11:50:06 PM8/26/14
to erpnext-dev...@googlegroups.com
"
if fortype=="doctype":
messages = get_messages_from_doctype(name)
elif fortype=="page":
messages = get_messages_from_page(name)
elif fortype=="report":
messages = get_messages_from_report(name)
elif fortype=="include":
messages = get_messages_from_include_files()
elif fortype=="jsfile":
messages = get_messages_from_file(name)
Wondering why get message from different part, in translated file, is it possible to identify which part?, say in permission manage page, "read", "write" any chance can't load translation?

Thanks for your effort.
Yang

在 2014年8月26日星期二UTC+8下午9时11分42秒,Y Y写道:

Y Y

unread,
Aug 27, 2014, 3:43:36 AM8/27/14
to erpnext-dev...@googlegroups.com
__("No {0} found", ' %(doctype_label)s '), it doesn't work, i checked client side__("Supplier") has translation, but doesn't work this way.

may i know where is the definition of __() function, by the way, i used bench frappe --build to update js.

thanks.

在 2014年8月27日星期三UTC+8上午11时50分06秒,Y Y写道:

Y Y

unread,
Aug 27, 2014, 4:01:52 AM8/27/14
to erpnext-dev...@googlegroups.com
haha, someone who want to do translation and do code change may be find this very useful....

__("No {0} found", ' %(doctype_label)s '),  it has to be __("No {0} found", [' %(doctype_label)s ']), please note[], it uses values inside to matches {0}, {1}, smart, 

Better we need documentation:(

在 2014年8月27日星期三UTC+8下午3时43分36秒,Y Y写道:

Rushabh Mehta

unread,
Aug 27, 2014, 4:32:21 AM8/27/14
to erpnext-dev...@googlegroups.com
On 27-Aug-2014, at 1:31 pm, Y Y <yangy...@gmail.com> wrote:

haha, someone who want to do translation and do code change may be find this very useful....

__("No {0} found", ' %(doctype_label)s '),  it has to be __("No {0} found", [' %(doctype_label)s ']), please note[], it uses values inside to matches {0}, {1}, smart, 

Yeah this is to mimic Python-like behaviour in JS :)


Better we need documentation:(

We are aware - hopefully we will be able to setup something soon.

-- 
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

Y Y

unread,
Aug 27, 2014, 6:18:02 AM8/27/14
to erpnext-dev...@googlegroups.com
Forgive me that i'm was in .net and php world, haha

在 2014年8月27日星期三UTC+8下午4时32分21秒,rushabh写道:

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages