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.
|
||||
@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}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user