diff options
author | Bastien Guerry <bzg@altern.org> | 2011-02-13 13:57:06 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-02-13 13:57:06 +0100 |
commit | 9b23f082ea22744c4b0c99b0c6323e402c07370a (patch) | |
tree | 29a99498f8aee8aa78a0fa3f48936aefe320d57d | |
parent | 706f2da458e9575fb3b9b1e706cd073582e4df74 (diff) | |
download | org-mode-9b23f082ea22744c4b0c99b0c6323e402c07370a.tar.gz |
lisp/org-clock.el: allow to set the language through a new :lang parameter.
* org-clock.el (org-clock-clocktable-language-setup): New
custom variable.
(org-clocktable-defaults): Set the default language.
(org-clocktable-write-default): Use the new variable.
-rw-r--r-- | doc/org.texi | 1 | ||||
-rw-r--r-- | lisp/org-clock.el | 72 |
2 files changed, 43 insertions, 30 deletions
diff --git a/doc/org.texi b/doc/org.texi index 49a9cb9..0a5b065 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -5859,6 +5859,7 @@ options are interpreted by the function @code{org-clocktable-write-default}, but you can specify your own function using the @code{:formatter} parameter. @example :emphasize @r{When @code{t}, emphasize level one and level two items.} +:lang @r{Language@footnote{Language terms can be set through the variable @code{org-clock-clocktable-language-setup}.} to use for descriptive cells like "Task".} :link @r{Link the item headlines in the table to their origins.} :narrow @r{An integer to limit the width of the headline column in} @r{the org table. If you write it like @samp{50!}, then the} diff --git a/lisp/org-clock.el b/lisp/org-clock.el index dac035f..5de2733 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -228,25 +228,26 @@ string as argument." :group 'org-clock) (defcustom org-clocktable-defaults - (list - :maxlevel 2 - :scope 'file - :block nil - :tstart nil - :tend nil - :step nil - :stepskip0 nil - :fileskip0 nil - :tags nil - :emphasize nil - :link nil - :narrow '40! - :indent t - :formula nil - :timestamp nil - :level nil - :tcolumns nil - :formatter nil) + `(list + :maxlevel 2 + :lang ,org-export-default-language + :scope 'file + :block nil + :tstart nil + :tend nil + :step nil + :stepskip0 nil + :fileskip0 nil + :tags nil + :emphasize nil + :link nil + :narrow '40! + :indent t + :formula nil + :timestamp nil + :level nil + :tcolumns nil + :formatter nil) "Default properties for clock tables." :group 'org-clock :type 'plist) @@ -257,6 +258,13 @@ For more information, see `org-clocktable-write-default'." :group 'org-clocktable :type 'function) +(defcustom org-clock-clocktable-language-setup + '(("en" "File" "L" "Timestamp" "Headline" "Time" "ALL" "Total time" "File time") + ("fr" "Fichier" "N" "Horodatage" "Tâche" "Durée" "TOUT" "Durée totale" "Durée fichier")) + "Terms used in clocktable, translated to different languages." + :group 'org-clocktable + :type 'alist) + (defcustom org-clock-clocktable-default-properties '(:maxlevel 2 :scope file) "Default properties for new clocktables. These will be inserted into the BEGIN line, to make it easy for users to @@ -2016,6 +2024,8 @@ from the dynamic block defintion." ;; there own special formatter, this maybe much easier because there can ;; be a fixed format with a well-defined number of columns... (let* ((hlchars '((1 . "*") (2 . "/"))) + (lwords (assoc (plist-get params :lang) + org-clock-clocktable-language-setup)) (multifile (plist-get params :multifile)) (block (plist-get params :block)) (ts (plist-get params :tstart)) @@ -2095,19 +2105,21 @@ from the dynamic block defintion." ;; Insert the table header line (insert-before-markers "|" ; table line starter - (if multifile "File|" "") ; file column, maybe - (if level-p "L|" "") ; level column, maybe - (if timestamp "Timestamp|" "") ; timestamp column, maybe - "Headline|Time|\n") ; headline and time columns + (if multifile (concat (nth 1 lwords) "|") "") ; file column, maybe + (if level-p (concat (nth 2 lwords) "|") "") ; level column, maybe + (if timestamp (concat (nth 3 lwords) "|") "") ; timestamp column, maybe + (concat (nth 4 lwords) "|" + (nth 5 lwords) "|\n")) ; headline and time columns ;; Insert the total time in the table (insert-before-markers - "|-\n" ; a hline - "|" ; table line starter - (if multifile "| ALL " "") ; file column, maybe - (if level-p "|" "") ; level column, maybe - (if timestamp "|" "") ; timestamp column, maybe - "*Total time*| " ; instead of a headline + "|-\n" ; a hline + "|" ; table line starter + (if multifile (concat "| " (nth 6 lwords) " ") "") + ; file column, maybe + (if level-p "|" "") ; level column, maybe + (if timestamp "|" "") ; timestamp column, maybe + (concat "*" (nth 7 lwords) "*| ") ; instead of a headline "*" (org-minutes-to-hh:mm-string (or total-time 0)) ; the time "*|\n") ; close line @@ -2126,7 +2138,7 @@ from the dynamic block defintion." (when multifile ;; Summarize the time colleted from this file (insert-before-markers - (format "| %s %s | %s*File time* | *%s*|\n" + (format (concat "| %s %s | %s*" (nth 8 lwords) "* | *%s*|\n") (file-name-nondirectory (car tbl)) (if level-p "| " "") ; level column, maybe (if timestamp "| " "") ; timestamp column, maybe |