Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dev:translators:coding [2018/12/26 06:49]
dstillman Add proxy: false attachment flag
dev:translators:coding [2019/09/30 00:18] (current)
dstillman Change GitHub utilities.js link from 4.0 to master
Line 238: Line 238:
 ===== Utility Functions ===== ===== Utility Functions =====
  
-Zotero provides several [[https://​github.com/​zotero/​zotero/​blob/​4.0/​chrome/​content/​zotero/​xpcom/​utilities.js|utility functions]] for translators to use. Some of them are used for asynchronous and synchronous HTTP requests; those are [[#​batch_saving|discussed above]]. In addition to those HTTP functions and the many standard functions provided by JavaScript, Zotero provides:+Zotero provides several [[https://​github.com/​zotero/​zotero/​blob/​master/​chrome/​content/​zotero/​xpcom/​utilities.js|utility functions]] for translators to use. Some of them are used for asynchronous and synchronous HTTP requests; those are [[#​batch_saving|discussed above]]. In addition to those HTTP functions and the many standard functions provided by JavaScript, Zotero provides:
   * ''​Zotero.Utilities.capitalizeTitle(title,​ ignorePreference)''​\\ Applies English-style title case to the string, if the capitalizeTitles [[/​support/​hidden_prefs|hidden preference]] is set. If ''​ignorePreference''​ is true, title case will be applied even if the preference is set to false. This function is often useful for fixing capitalization of personal names, in conjunction with the built-in string method ''​text.toLowerCase()''​.   * ''​Zotero.Utilities.capitalizeTitle(title,​ ignorePreference)''​\\ Applies English-style title case to the string, if the capitalizeTitles [[/​support/​hidden_prefs|hidden preference]] is set. If ''​ignorePreference''​ is true, title case will be applied even if the preference is set to false. This function is often useful for fixing capitalization of personal names, in conjunction with the built-in string method ''​text.toLowerCase()''​.
   * ''​Zotero.Utilities.cleanAuthor(author,​ creatorType,​ hasComma)''​\\ Attempts to split the given string into firstName and lastName components, splitting on a comma if desired and performs some clean-up (e.g. removes unnecessary white-spaces and punctuation). The creatorType (see the [[http://​gimranov.com/​research/​zotero/​creator-types|list of valid creator types]] for each item type) will be just passed trough. Returns a creator object of the form: ''​{ lastName: , firstName: , creatorType:​ }'',​ which can for example used directly in ''​item.creators.push()''​ as argument.   * ''​Zotero.Utilities.cleanAuthor(author,​ creatorType,​ hasComma)''​\\ Attempts to split the given string into firstName and lastName components, splitting on a comma if desired and performs some clean-up (e.g. removes unnecessary white-spaces and punctuation). The creatorType (see the [[http://​gimranov.com/​research/​zotero/​creator-types|list of valid creator types]] for each item type) will be just passed trough. Returns a creator object of the form: ''​{ lastName: , firstName: , creatorType:​ }'',​ which can for example used directly in ''​item.creators.push()''​ as argument.
dev/translators/coding.txt ยท Last modified: 2019/09/30 00:18 by dstillman