? 639328-better_docs_for_hook_locale.patch
Index: modules/locale/locale.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.api.php,v
retrieving revision 1.7
diff -u -p -r1.7 locale.api.php
--- modules/locale/locale.api.php	16 Oct 2009 15:47:46 -0000	1.7
+++ modules/locale/locale.api.php	21 Nov 2009 20:14:19 -0000
@@ -15,12 +15,29 @@
  * Allows modules to define their own text groups that can be translated.
  *
  * @param $op
- *   Type of operation. Currently, only supports 'groups'.
+ *   Type of operation:
+ *   - 'groups': return an array of text groups, key being the internally
+ *     used code name, value being the string shown to the user.
+ *   - 'refresh': return nothing, but refresh the locale strings in all
+ *     of the module's text groups.
+ *   - 'info': return a two-level array with localization info for the
+ *     module, first-level key being the internally used code name of the
+ *     text group (see 'groups' above), second-level key being
+ *     'refresh callback', second-level value being a function name which
+ *     does the actual refreshing.
  */
 function hook_locale($op = 'groups') {
   switch ($op) {
     case 'groups':
       return array('custom' => t('Custom'));
+    case 'refresh':
+      if (module_exists('i18nstrings')) {
+        tt('custom:foo:bar', t('Custom'));
+      }
+      break;
+    case 'info':
+      $info = ['custom']['refresh callback'] = 'custom_locale_refresh';
+      return $info;
   }
 }
 
