mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-25 07:27:57 +00:00
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.
This commit is contained in:
parent
706f2da458
commit
9b23f082ea
@ -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.
|
but you can specify your own function using the @code{:formatter} parameter.
|
||||||
@example
|
@example
|
||||||
:emphasize @r{When @code{t}, emphasize level one and level two items.}
|
: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.}
|
: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}
|
: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}
|
@r{the org table. If you write it like @samp{50!}, then the}
|
||||||
|
@ -228,25 +228,26 @@ string as argument."
|
|||||||
:group 'org-clock)
|
:group 'org-clock)
|
||||||
|
|
||||||
(defcustom org-clocktable-defaults
|
(defcustom org-clocktable-defaults
|
||||||
(list
|
`(list
|
||||||
:maxlevel 2
|
:maxlevel 2
|
||||||
:scope 'file
|
:lang ,org-export-default-language
|
||||||
:block nil
|
:scope 'file
|
||||||
:tstart nil
|
:block nil
|
||||||
:tend nil
|
:tstart nil
|
||||||
:step nil
|
:tend nil
|
||||||
:stepskip0 nil
|
:step nil
|
||||||
:fileskip0 nil
|
:stepskip0 nil
|
||||||
:tags nil
|
:fileskip0 nil
|
||||||
:emphasize nil
|
:tags nil
|
||||||
:link nil
|
:emphasize nil
|
||||||
:narrow '40!
|
:link nil
|
||||||
:indent t
|
:narrow '40!
|
||||||
:formula nil
|
:indent t
|
||||||
:timestamp nil
|
:formula nil
|
||||||
:level nil
|
:timestamp nil
|
||||||
:tcolumns nil
|
:level nil
|
||||||
:formatter nil)
|
:tcolumns nil
|
||||||
|
:formatter nil)
|
||||||
"Default properties for clock tables."
|
"Default properties for clock tables."
|
||||||
:group 'org-clock
|
:group 'org-clock
|
||||||
:type 'plist)
|
:type 'plist)
|
||||||
@ -257,6 +258,13 @@ For more information, see `org-clocktable-write-default'."
|
|||||||
:group 'org-clocktable
|
:group 'org-clocktable
|
||||||
:type 'function)
|
: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)
|
(defcustom org-clock-clocktable-default-properties '(:maxlevel 2 :scope file)
|
||||||
"Default properties for new clocktables.
|
"Default properties for new clocktables.
|
||||||
These will be inserted into the BEGIN line, to make it easy for users to
|
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
|
;; there own special formatter, this maybe much easier because there can
|
||||||
;; be a fixed format with a well-defined number of columns...
|
;; be a fixed format with a well-defined number of columns...
|
||||||
(let* ((hlchars '((1 . "*") (2 . "/")))
|
(let* ((hlchars '((1 . "*") (2 . "/")))
|
||||||
|
(lwords (assoc (plist-get params :lang)
|
||||||
|
org-clock-clocktable-language-setup))
|
||||||
(multifile (plist-get params :multifile))
|
(multifile (plist-get params :multifile))
|
||||||
(block (plist-get params :block))
|
(block (plist-get params :block))
|
||||||
(ts (plist-get params :tstart))
|
(ts (plist-get params :tstart))
|
||||||
@ -2095,19 +2105,21 @@ from the dynamic block defintion."
|
|||||||
;; Insert the table header line
|
;; Insert the table header line
|
||||||
(insert-before-markers
|
(insert-before-markers
|
||||||
"|" ; table line starter
|
"|" ; table line starter
|
||||||
(if multifile "File|" "") ; file column, maybe
|
(if multifile (concat (nth 1 lwords) "|") "") ; file column, maybe
|
||||||
(if level-p "L|" "") ; level column, maybe
|
(if level-p (concat (nth 2 lwords) "|") "") ; level column, maybe
|
||||||
(if timestamp "Timestamp|" "") ; timestamp column, maybe
|
(if timestamp (concat (nth 3 lwords) "|") "") ; timestamp column, maybe
|
||||||
"Headline|Time|\n") ; headline and time columns
|
(concat (nth 4 lwords) "|"
|
||||||
|
(nth 5 lwords) "|\n")) ; headline and time columns
|
||||||
|
|
||||||
;; Insert the total time in the table
|
;; Insert the total time in the table
|
||||||
(insert-before-markers
|
(insert-before-markers
|
||||||
"|-\n" ; a hline
|
"|-\n" ; a hline
|
||||||
"|" ; table line starter
|
"|" ; table line starter
|
||||||
(if multifile "| ALL " "") ; file column, maybe
|
(if multifile (concat "| " (nth 6 lwords) " ") "")
|
||||||
(if level-p "|" "") ; level column, maybe
|
; file column, maybe
|
||||||
(if timestamp "|" "") ; timestamp column, maybe
|
(if level-p "|" "") ; level column, maybe
|
||||||
"*Total time*| " ; instead of a headline
|
(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
|
(org-minutes-to-hh:mm-string (or total-time 0)) ; the time
|
||||||
"*|\n") ; close line
|
"*|\n") ; close line
|
||||||
@ -2126,7 +2138,7 @@ from the dynamic block defintion."
|
|||||||
(when multifile
|
(when multifile
|
||||||
;; Summarize the time colleted from this file
|
;; Summarize the time colleted from this file
|
||||||
(insert-before-markers
|
(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))
|
(file-name-nondirectory (car tbl))
|
||||||
(if level-p "| " "") ; level column, maybe
|
(if level-p "| " "") ; level column, maybe
|
||||||
(if timestamp "| " "") ; timestamp column, maybe
|
(if timestamp "| " "") ; timestamp column, maybe
|
||||||
|
Loading…
Reference in New Issue
Block a user