* Swedish calendar localization in official release (sv-kalender.el)? @ 2021-07-04 11:40 Arthur Miller 2021-07-05 11:51 ` Stefan Kangas 0 siblings, 1 reply; 16+ messages in thread From: Arthur Miller @ 2021-07-04 11:40 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 1423 bytes --] Just a question/suggestion: can we get a localized calendar for swedish language into official release? There is a small file by Daniel Jensen, found at: http://bigwalter.net/daniel/elisp/. I did a small hack to it, just added names for abbreviated day names and header array since it seems to not be properly initialized if sv-kalender is loaded after the calender.el. In a short mail correspondence with Daniel, he says he has signed FSF copyrights, so I guess, legaly it shouldn't be a problem to include that file amongst few other localizations in lisp/calender? I don't know what is your policy to include localizations, I see there are not many there, and those that are there (French "revolutionary") and Chinese do much more than just localize names and few hollidays. Anyway, it would be convenient if it was included. Maybe the name of the file itself should be adjusted, like calender-swedish.el or something? Also a side question about localizations as found on Emacs Wiki: https://www.emacswiki.org/emacs/CalendarLocalization I can't imagine that day and month names and few other bits related to that information can be copyrighted. Would ot be interesting to collect info from that wiki page into some file with localized names and maybe have Emacs auto load localized names when avialable based on value in LANG env (or whatever variable is suitable), and a variable to turn on/off that behaviour? [-- Attachment #2: sv-kalender.el --] [-- Type: text/plain, Size: 10946 bytes --] ;;; sv-kalender.el --- Swedish calendar for Emacs ;; Copyright (C) 2002,2003,2004,2007,2009,2018 Daniel Jensen ;; Author: Daniel Jensen <daniel@bigwalter.net> ;; Version: 1.9 ;; Keywords: calendar swedish localization ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;;; Kommentarer: ;; Swedish calendar localization. Note: Only a few comments in this ;; file are in English. The rest is in Swedish. ;; Denna fil modifierar hur Emacs kalender ser ut. Den byter namn på ;; veckodagar, månader etc., samt inför svenska helgdagar och högtider ;; i stället för de amerikanska. ;; ;; För att använda den svenska kalendern, spara filen i din load-path ;; och använd (load "sv-kalender") i din ~/.emacs. ;;; History (ändringar): ;; 1.9.1 - added provide statement ;; 1.9 - Update for Emacs 25 ;; 1.8 - Emacs 23 support. GPLv3. ;; 1.6 - Lunar phase names, sunrise/sunset ;; (månfasernas namn, soluppgång och -nedgång) ;; 1.5 - Cleanup, introduce sv prefix (städning, nytt sv-prefix) ;; 1.4 - Months and days use lower-case initials ;; (månader och dagar med små begynnelsebokstäver) ;; 1.3 - New flag days, Easter bug fixes ;; (nya flaggdagar och en bugg i "mer påsk" fixad) (Alan Campbell) ;; 1.2 - Advent Sundays fixed (adventsdagarna justerade) (Alan Campbell) ;; 1.1 - Fat Tuesday moved back a week (fettisdagen flyttad en vecka bakåt). ;;; Code: (require 'calendar) (require 'holidays) (require 'solar) (require 'lunar) ;; Veckan börjar med en måndag (setq calendar-week-start-day 1) ;; Använd "europeiska" datum (dag/måndad) (setq calendar-date-style 'european) ;; Datumformat (setq calendar-date-display-form '((if dayname (concat dayname ", ")) day " " monthname " " year)) ;; 24-timmarsklocka utan tidszon (setq calendar-time-display-form '(24-hours ":" minutes)) ;; Dagarnas namn (setq calendar-day-name-array ["söndag" "måndag" "tisdag" "onsdag" "torsdag" "fredag" "lördag"] calendar-day-abbrev-array ["sön" "mån" "tis" "ons" "tors" "fre" "lör"] calendar-day-header-array ["sö" "må" "ti" "on" "to" "fr" "lö"]) ;; Månadernas namn (setq calendar-month-name-array ["januari" "februari" "mars" "april" "maj" "juni" "juli" "augusti" "september" "oktober" "november" "december"]) ;; Årets vändpunkter (eval-after-load "solar" '(setq solar-n-hemi-seasons '("Vårdagjämningen" "Sommarsolståndet" "Höstdagjämningen" "Vintersolståndet"))) ;; Månfaser (defadvice lunar-phase-name (around sv-lunar-phase-name activate) "Månfasernas namn på svenska." (setq ad-return-value (let ((phase (ad-get-arg 0))) (cond ((= 0 phase) "Nymåne") ((= 1 phase) "Växande halvmåne") ((= 2 phase) "Fullmåne") ((= 3 phase) "Avtagande halvmåne"))))) ;; Soluppgång och -nedgång (defadvice solar-sunrise-sunset-string (around sv-solar-sunrise-sunset-string activate) "Soluppgång och solnedgång på svenska." (setq ad-return-value (let ((l (solar-sunrise-sunset date))) (format "%s, %s vid %s (%s timmar dagsljus)" (if (car l) (concat "Sol upp " (apply 'solar-time-string (car l))) "Ingen soluppgång") (if (car (cdr l)) (concat "ned " (apply 'solar-time-string (car (cdr l)))) "ingen solnedgång") (eval calendar-location-name) (car (cdr (cdr l))))))) ;; Göm vissa helgdagar? (defvar sv-hide-some-holidays nil "Non-nil means some holidays won't show in the calendar. Om icke-nil, göm vissa helgdagar i kalendern.") ;; Påskdagen (from holiday-easter-etc) (defun sv-easter (year) "Calculate the date for Easter in YEAR. Beräkna påskdagen för år YEAR." (let* ((century (1+ (/ year 100))) (shifted-epact (% (+ 14 (* 11 (% year 19)) (- (/ (* 3 century) 4)) (/ (+ 5 (* 8 century)) 25) (* 30 century)) 30)) (adjusted-epact (if (or (= shifted-epact 0) (and (= shifted-epact 1) (< 10 (% year 19)))) (1+ shifted-epact) shifted-epact)) (paschal-moon (- (calendar-absolute-from-gregorian (list 4 19 year)) adjusted-epact))) (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) ;; Helgdagar (setq holiday-general-holidays '((holiday-fixed 1 1 "Nyårsdagen") (holiday-fixed 1 6 "Trettondedag jul") ;; Påsk och pingst (holiday-filter-visible-calendar (mapcar (lambda (dag) (list (calendar-gregorian-from-absolute (+ (sv-easter displayed-year) (car dag))) (cadr dag))) '(( -2 "Långfredagen") ( -1 "Påskafton") ( 0 "Påskdagen") ( +1 "Annandag påsk") ( +39 "Kristi himmelfärdsdag") ( +49 "Pingstdagen") ( +50 "Annandag pingst")))) (holiday-fixed 5 1 "Första maj") (let ((midsommar-d (calendar-dayname-on-or-before 6 (calendar-absolute-from-gregorian (list 6 26 displayed-year))))) ;; Midsommar (holiday-filter-visible-calendar (list (list (calendar-gregorian-from-absolute (1- midsommar-d)) "Midsommarafton") (list (calendar-gregorian-from-absolute midsommar-d) "Midsommardagen") ;; Alla helgons dag (list (calendar-gregorian-from-absolute (calendar-dayname-on-or-before 6 (calendar-absolute-from-gregorian (list 11 6 displayed-year)))) "Alla helgons dag")))) (holiday-fixed 12 25 "Juldagen") (holiday-fixed 12 26 "Annandag jul"))) ;; Andra högtider (setq holiday-other-holidays '((holiday-fixed 1 13 "Tjugondag Knut") (unless sv-hide-some-holidays (holiday-fixed 1 28 "Konungens namnsdag")) (unless sv-hide-some-holidays (holiday-fixed 2 2 "Kyndelsmässodagen")) (holiday-fixed 2 14 "Alla hjärtans dag") ;; Fettisdagen (holiday-filter-visible-calendar (list (list (calendar-gregorian-from-absolute (calendar-dayname-on-or-before 2 (- (sv-easter displayed-year) 47))) "Fettisdagen"))) (holiday-fixed 3 8 "Internationella kvinnodagen") (unless sv-hide-some-holidays (holiday-fixed 3 12 "Kronprinsessans namnsdag")) (holiday-fixed 3 25 "Vårfrudagen") ;; Mer påsk (holiday-filter-visible-calendar (mapcar (lambda (dag) (list (calendar-gregorian-from-absolute (+ (sv-easter displayed-year) (car dag))) (cadr dag))) (if sv-hide-some-holidays '(( -3 "Skärtorsdagen")) '(( -7 "Palmsöndagen") ( -4 "Dymmelonsdagen") ( -3 "Skärtorsdagen"))))) (unless sv-hide-some-holidays (holiday-fixed 4 30 "Konungens födelsedag")) (unless sv-hide-some-holidays (holiday-fixed 4 1 "Första april")) (holiday-fixed 4 30 "Valborgsmässoafton") (holiday-float 5 0 -1 "Mors dag") (holiday-fixed 6 6 "Sveriges nationaldag") (unless sv-hide-some-holidays (holiday-fixed 7 14 "Kronprinsessans födelsedag")) (unless sv-hide-some-holidays (holiday-fixed 8 8 "Drottningens namnsdag")) (holiday-fixed 10 24 "FN-dagen") (holiday-float 11 0 2 "Fars dag") (unless sv-hide-some-holidays (holiday-fixed 11 6 "Gustaf Adolfsdagen")) (holiday-fixed 11 10 "Mårtensafton") (holiday-float 12 0 -4 "Första advent" 24) (holiday-float 12 0 -3 "Andra advent" 24) (holiday-float 12 0 -2 "Tredje advent" 24) (holiday-float 12 0 -1 "Fjärde advent" 24) (holiday-fixed 12 10 "Nobeldagen") (holiday-fixed 12 13 "Lucia") (unless sv-hide-some-holidays (holiday-fixed 12 23 "Drottningens födelsedag")) (holiday-fixed 12 24 "Julafton") (holiday-fixed 12 31 "Nyårsafton"))) ;; Solstånd, dagjämningar, vinter- och sommartid (setq holiday-solar-holidays (if sv-hide-some-holidays nil '((if (fboundp 'atan) (solar-equinoxes-solstices)) (if (progn (require 'cal-dst) t) (funcall 'holiday-sexp calendar-daylight-savings-starts '(format "Sommartid börjar %s" (if (fboundp 'atan) (solar-time-string (/ calendar-daylight-savings-starts-time (float 60)) calendar-standard-time-zone-name) "")))) (funcall 'holiday-sexp calendar-daylight-savings-ends '(format "Vintertid börjar %s" (if (fboundp 'atan) (solar-time-string (/ calendar-daylight-savings-ends-time (float 60)) calendar-daylight-time-zone-name) "")))))) ;; Listan med kalenderns helgdagar (setq calendar-holidays (append holiday-general-holidays holiday-local-holidays holiday-other-holidays holiday-solar-holidays)) (provide 'sv-kalender) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-04 11:40 Swedish calendar localization in official release (sv-kalender.el)? Arthur Miller @ 2021-07-05 11:51 ` Stefan Kangas 2021-07-05 13:00 ` Teemu Likonen ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Stefan Kangas @ 2021-07-05 11:51 UTC (permalink / raw) To: Arthur Miller; +Cc: Emacs developers Arthur Miller <arthur.miller@live.com> writes: > Just a question/suggestion: can we get a localized calendar for swedish > language into official release? There is a small file by Daniel Jensen, > found at: http://bigwalter.net/daniel/elisp/. > > I did a small hack to it, just added names for abbreviated day names and > header array since it seems to not be properly initialized if > sv-kalender is loaded after the calender.el. > > In a short mail correspondence with Daniel, he says he has signed FSF > copyrights, so I guess, legaly it shouldn't be a problem to include that > file amongst few other localizations in lisp/calender? I support this proposal. If there are no legal issues, for me it's a no-brainer that this file (and some similar ones) should be included in Emacs itself. I don't know if others agree, but I have myself been wondering why sv-kalender.el is not just part of Emacs. If you are living in Sweden, the calendar is next to useless for many kinds of planning if you don't have that library loaded. The only drawback I see is that sometimes people stop maintaining things once they are merged into Emacs. I'm not sure what could be done about that, or if others here even share that concern. Perhaps we could set it up as a GNU ELPA core package? Or perhaps I'm worried for no reason. In any case, we should specifically ask the current maintainer to continue maintaining it inside of Emacs, and make it clear that we have no extra resources or volunteers on our end that can really help with that. Our motivation should be made clear: it is simply to distribute this useful library to more users. > Maybe the > name of the file itself should be adjusted, like calender-swedish.el or > something? (I don't know which conventions could be useful here, but note that Swedish is also spoken in Finland.) > Also a side question about localizations as found on Emacs Wiki: > > https://www.emacswiki.org/emacs/CalendarLocalization > > I can't imagine that day and month names and few other bits related to > that information can be copyrighted. Would ot be interesting to > collect info from that wiki page into some file with localized names > and maybe have Emacs auto load localized names when avialable based on > value in LANG env (or whatever variable is suitable), and a variable to > turn on/off that behaviour? From my perspective, the most useful part here is the code to calculate when the national holidays are, as the rules for that can be quite finicky. (See sv-kalender.el for example.) Including lists of month names and so on in various languages could also be useful, but we should make sure to do it in a clean way. Even just including sv-kalender.el (renamed to something suitable) so that a person living in Sweden can just (require 'sv-kalender) and be done with it is a useful step forward, I think. Thanks for looking into this. I hope we can see some results for Emacs 28. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-05 11:51 ` Stefan Kangas @ 2021-07-05 13:00 ` Teemu Likonen 2021-07-05 21:02 ` Arthur Miller 2021-07-05 20:58 ` Arthur Miller 2021-07-06 7:55 ` Teemu Likonen 2 siblings, 1 reply; 16+ messages in thread From: Teemu Likonen @ 2021-07-05 13:00 UTC (permalink / raw) To: Stefan Kangas, Arthur Miller; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 987 bytes --] * 2021-07-05 13:51:42+0200, Stefan Kangas wrote: > The only drawback I see is that sometimes people stop maintaining > things once they are merged into Emacs. I'm not sure what could be > done about that, or if others here even share that concern. Perhaps > we could set it up as a GNU ELPA core package? Or perhaps I'm worried > for no reason. For some reference, I have created and been maintaining Finnish national and Christian holidays package for Emacs. It is available through services that probably can't be named here. In my opinion it is not even copyright work. The calendar day locations itself are completely free in Finland. So my "work", if there is some, is Creative Commons CC0 (public domain dedication). But I would be fine with making this package available through GNU Elpa. https://github.com/tlikonen/suomalainen-kalenteri -- /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 251 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-05 13:00 ` Teemu Likonen @ 2021-07-05 21:02 ` Arthur Miller 0 siblings, 0 replies; 16+ messages in thread From: Arthur Miller @ 2021-07-05 21:02 UTC (permalink / raw) To: Teemu Likonen; +Cc: Stefan Kangas, emacs-devel Teemu Likonen <tlikonen@iki.fi> writes: > * 2021-07-05 13:51:42+0200, Stefan Kangas wrote: > >> The only drawback I see is that sometimes people stop maintaining >> things once they are merged into Emacs. I'm not sure what could be >> done about that, or if others here even share that concern. Perhaps >> we could set it up as a GNU ELPA core package? Or perhaps I'm worried >> for no reason. > > For some reference, I have created and been maintaining Finnish national > and Christian holidays package for Emacs. It is available through > services that probably can't be named here. In my opinion it is not even > copyright work. The calendar day locations itself are completely free in > Finland. So my "work", if there is some, is Creative Commons CC0 (public > domain dedication). > > But I would be fine with making this package available through GNU Elpa. > > https://github.com/tlikonen/suomalainen-kalenteri I was actually looking at it yesterday. I adapted Daniel's code to croatian calendar and was looking at different implementations. Yours seem to be on the nicer side: you seem to be the only one who actually packaged it as a package. Now I don't understand Finnish language, but I see 'Melpa' spelled with bold style on your project page, so I guess it is in Melpa repo :). ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-05 11:51 ` Stefan Kangas 2021-07-05 13:00 ` Teemu Likonen @ 2021-07-05 20:58 ` Arthur Miller 2021-07-06 7:55 ` Teemu Likonen 2 siblings, 0 replies; 16+ messages in thread From: Arthur Miller @ 2021-07-05 20:58 UTC (permalink / raw) To: Stefan Kangas; +Cc: Emacs developers [-- Attachment #1: Type: text/plain, Size: 7459 bytes --] Stefan Kangas <stefan@marxist.se> writes: > Arthur Miller <arthur.miller@live.com> writes: > >> Just a question/suggestion: can we get a localized calendar for swedish >> language into official release? There is a small file by Daniel Jensen, >> found at: http://bigwalter.net/daniel/elisp/. >> >> I did a small hack to it, just added names for abbreviated day names and >> header array since it seems to not be properly initialized if >> sv-kalender is loaded after the calender.el. >> >> In a short mail correspondence with Daniel, he says he has signed FSF >> copyrights, so I guess, legaly it shouldn't be a problem to include that >> file amongst few other localizations in lisp/calender? > > I support this proposal. If there are no legal issues, for me it's a > no-brainer that this file (and some similar ones) should be included > in Emacs itself. I don't know if others agree, but I have myself been > wondering why sv-kalender.el is not just part of Emacs. If you are > living in Sweden, the calendar is next to useless for many kinds of > planning if you don't have that library loaded. > > The only drawback I see is that sometimes people stop maintaining > things once they are merged into Emacs. I'm not sure what could be > done about that, or if others here even share that concern. Perhaps > we could set it up as a GNU ELPA core package? Or perhaps I'm worried > for no reason. > > In any case, we should specifically ask the current maintainer to > continue maintaining it inside of Emacs, and make it clear that we > have no extra resources or volunteers on our end that can really help > with that. Our motivation should be made clear: it is simply to > distribute this useful library to more users. Agree, but being part of Emacs gives advantage that potentially more people will use it, and thus more likely that someone will repport a bug or contribute fix/improvement. I have forgott to cc Daniel in this mail, so I filed a bug repport/suggest where I have CC him, so we can ask him. >> Maybe the >> name of the file itself should be adjusted, like calender-swedish.el or >> something? > > (I don't know which conventions could be useful here, but note that > Swedish is also spoken in Finland.) Yes of course, I meant something like calendar-LANGCODE.el, so say calendar-sv_SE.el or calendar-sv_FI.el, so Emacs could choose to load appropriate file based on value in LANG env. >> Also a side question about localizations as found on Emacs Wiki: >> >> https://www.emacswiki.org/emacs/CalendarLocalization >> >> I can't imagine that day and month names and few other bits related to >> that information can be copyrighted. Would ot be interesting to >> collect info from that wiki page into some file with localized names >> and maybe have Emacs auto load localized names when avialable based on >> value in LANG env (or whatever variable is suitable), and a variable to >> turn on/off that behaviour? > > From my perspective, the most useful part here is the code to > calculate when the national holidays are, as the rules for that can be > quite finicky. (See sv-kalender.el for example.) Indeed. I adapted yesterday Daniel's code to croatian language. Partly because I haven't seen it in the list on Wiki, partly to learn a bit more about calendar. What I have noticed immidiately about hollidays, even those that has to be calculated like Easter, are actually very same for different countries. I mean croats are mostly catholics, and catholic easter is same date as protestant's since it is calculated by the same calendar. I guess same follows for say Russian/Serbian/Greek calendar. So what really has to be translated are just names of those hollidays. Compare attached adaptation from sv-kalender to the attached calender-hr.el. > Including lists of month names and so on in various languages could > also be useful, but we should make sure to do it in a clean way. I was thinking bit of it today, and as I see, ther are mostly strings that needs to be localized, since for the most part calculations are already included in Emacs. As I see there are: 1) strings for the day and month names and their abbreviations that every language has to set. Those appear in the calendar buffer when user runs calendar. 2) date string has to be adapted to the locale. 3) names of religious hollidays, lunar/solar phases etc has to be translated. Calculations can be re-used (somehow). For catholic hollidays are same dates in most europian countries (? am I correct, I am not 100% but I have faith in this :)). Not all are celebrated or equally important in every country, but thay all have names. 4) country specific hollidays, usually official hollidays have to be calculated. This are usually fixed, and can't be translated since they are specific for each country 5) some hardcoded strings in calendar.el that appear in minibuffer or elsewhere. I haven't seen any of localizations translate those, but it would be icing on the cake if we that could be done too :). It would be nice if we could somehow translate only strings to avoid duplication of code as we see now in different translations. I am not sure how to do this. Easy one is to re-declare everything as it is done now by different localizations. That excludes hardcoded strings as in 5). I am though thinking of something else, but I am not sure if it would be possible: a minor mode that translates strings as found in symbols automatically. Say if I give it a function or a variable name, it would look up a list in the function value of a symbol and patch all the strings in that list by replacing list element with its translation? Say something like: (translate-var 'holliday-general-hollidays '((list-from1 . list-to1) (list-from2 . list-to2) ... (list-fromN . list-toN))) And similar `translate-fn'. A variation would be to populate some hash-map with strings list-to1, ... list-toN, and use list-from1, ... , list-fromN as keys for lookup. I could then define a minor mode,, say calendar-localize-hr, and call translate function on bunch of symbols where I just need to specify those pairs for translations. I mean that just as a rough sketch of the idea, I understand it would be complicated in practice, but would this be possible to do in Elisp? I mean, in interpreated code it should be possible, but I am not sure if it would work with native compiler? Thus a translation would specify name of symbol to translate and list of pairs to serve as a lookup/translation. It could also be used to undo translation if mode is unloaded. Would of course work only from/to the english language but wouldn't require existing code to be changed, and could be used elsewhere in Emacs for localizations? > Even just including sv-kalender.el (renamed to something suitable) so > that a person living in Sweden can just (require 'sv-kalender) and be > done with it is a useful step forward, I think. I agree. It would be even nicer it this could be required automatically by Emacs, say based on a value of some variable in customize. I see a lot of manual repetition which to me seems a bit unnecessary. Why should every user have to retype this, when it can be done once only. > Thanks for looking into this. I hope we can see some results for Emacs 28. Thanks for the input and response, I appolgozie for the very long mail. [-- Attachment #2: calendar-hr.el --] [-- Type: text/plain, Size: 10481 bytes --] ;;; calendar-hr.el --- Croatian calendar for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 2021 Daniel Jensen, Arthur Miller ;; Author: Arthur Miller <arthur.miller@live.com> ;; Author: Daniel Jensen <daniel@bigwalter.net> ;; Version: 1.0-hr ;; Keywords: calendar croatian localization ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; Croatian calendar localization. ;; This work is adapted versoio of the work by D. Jensen for the Swedish ;; calendar: http://bigwalter.net/daniel/elisp/ ;; ;; The calendar modifies names of days, months, and their abbrevs from their ;; English names to Croatian names. It also adds Croatian hollidays instead of ;; US ones. ;; ;; To use this file, save it somewhere in Emacs load-path and (load ;; "calendar-hr") in your Emacs init file. ;;; Changelog ;; 1.0-hr - Adapted to Croatian version. ;; 1.9.1 - added provide statement ;; 1.9 - Update for Emacs 25 ;; 1.8 - Emacs 23 support. GPLv3. ;; 1.6 - Lunar phase names, sunrise/sunset ;; (månfasernas namn, soluppgång och -nedgång) ;; 1.5 - Cleanup, introduce sv prefix (städning, nytt hr-prefix) ;; 1.4 - Months and days use lower-case initials ;; (månader och dagar med små begynnelsebokstäver) ;; 1.3 - New flag days, Easter bug fixes ;; (nya flaggdagar och en bugg i "mer påsk" fixad) (Alan Campbell) ;; 1.2 - Advent Sundays fixed (adventsdagarna justerade) (Alan Campbell) ;; 1.1 - Fat Tuesday moved back a week (fettisdagen flyttad en vecka bakåt). ;;; Code: (require 'calendar) (require 'holidays) (require 'solar) (require 'lunar) (defcustom calendar-hr-prefer-slavic-names t "If this variable is set to `t', names used for months are traditional slavic names as found in croatian language: Siječanj, Veljača, etc. If this variable is nil, then names used are based on international names: Januar, Februar etc." :type 'boolean :group 'calendar) (defvar calendar-month-names-genitive nil "Declension of month-names for genitive casus.") ;; The week starts with Monday (setq calendar-week-start-day 1) ;; Use Europian style when printed (setq calendar-date-style 'european) ;; Dateformat (setq calendar-date-display-form '((if dayname (concat dayname ", ")) day ". " (hr-month-filter monthname) " " year)) ;; 24-hour clock without a timezone (setq calendar-time-display-form '(24-hours ":" minutes)) ;; get genitive casus form for the month name (defun hr-month-filter (date) (catch 'done (let ((i 0)) (while (< i 12) (when (equal date (aref calendar-month-name-array i)) (throw 'done (aref calendar-month-names-genitive i))) (setq i (1+ i)))))) ;; Dagarnas namn (setq calendar-day-name-array ["nedjelja" "ponedjeljak" "utorak" "srijeda" "četvrtak" "petak" "subota"] calendar-day-abbrev-array ["ned" "pon" "uto" "srj" "čet" "pet" "sub"] calendar-day-header-array ["nd" "pn" "ut" "sr" "čt" "pt" "sb"]) ;; Month names (setq calendar-month-name-array (if calendar-hr-prefer-slavic-names ["siječanj" "veljača" "ožujak" "travanj" "svibanj" "lipanj" "srpanj" "kolovoz" "rujan" "listopad" "studeni" "prosinac"] ["januar" "februar" "mart" "april" "maj" "jun" "jul" "avgust" "septembar" "oktobar" "novembar" "decembar"])) (setq calendar-month-names-genitive (if calendar-hr-prefer-slavic-names ["siječnja" "veljače" "ožujka" "travnja" "svibnja" "lipnja" "srpnja" "kolovoza" "rujna" "listopada" "studenog" "prosinca"] ["januara" "februara" "marta" "aprila" "maja" "juna" "jula" "avgusta" "septembra" "oktobra" "novembra" "decembra"])) (eval-after-load "solar" '(setq solar-n-hemi-seasons '("Proljetna ravnodnevica" "Ljetni suncostaj" "Jesenska ravnodnevica" "Zimski suncostaj"))) ;; Lunar phases (defadvice lunar-phase-name (around hr-lunar-phase-name activate) "Mjesečeve mjene na hrvatskom." (setq ad-return-value (let ((phase (ad-get-arg 0))) (cond ((= 0 phase) "Mladi mjesec") ((= 1 phase) "Prva četvrt") ((= 2 phase) "Puni mjesec") ((= 3 phase) "Posljednja četvrt"))))) ;; Sunrise and sunset (defadvice solar-sunrise-sunset-string (around hr-solar-sunrise-sunset-string activate) "Izlazak i zalazak Sunca na hrvatskom." (setq ad-return-value (let ((l (solar-sunrise-sunset date))) (format "%s, %s u %s (%s sati dnevnog svijetla)" (if (car l) (concat "Sunce izašlo " (apply 'solar-time-string (car l))) "bez sunčevog izlaska") (if (car (cdr l)) (concat "Sunce zašlo " (apply 'solar-time-string (car (cdr l)))) "bez sunčevog zalaska") (eval calendar-location-name) (car (cdr (cdr l))))))) ;; Do not show some holidays (defvar hr-hide-some-holidays nil "Non-nil means some holidays won't show in the calendar.") ;; Uskršnji dan (from holiday-easter-etc) (defun hr-easter (year) "Calculate the date for Easter in YEAR." (let* ((century (1+ (/ year 100))) (shifted-epact (% (+ 14 (* 11 (% year 19)) (- (/ (* 3 century) 4)) (/ (+ 5 (* 8 century)) 25) (* 30 century)) 30)) (adjusted-epact (if (or (= shifted-epact 0) (and (= shifted-epact 1) (< 10 (% year 19)))) (1+ shifted-epact) shifted-epact)) (paschal-moon (- (calendar-absolute-from-gregorian (list 4 19 year)) adjusted-epact))) (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))) (setq holiday-general-holidays '((holiday-fixed 1 1 "Nova godina") (holiday-fixed 1 6 "Bogojavnljenje ili Sveta tri kralja") (holiday-fixed 5 1 "Praznik rada") (holiday-fixed 5 30 "Dan državnosti") (holiday-fixed 6 22 "Dan antifašističke borbe") (holiday-fixed 8 05 "Dan pobjede i Dan hrvatskih branitelja") (holiday-fixed 8 15 "Velika Gospa") (holiday-fixed 11 1 "Svi sveti") ;; fixed holliday in Croatia (holiday-fixed 11 18 "Dan sjećanja na žrtve Domovinskog rata") (holiday-fixed 12 25 "Božić") (holiday-fixed 12 26 "Sveti Stjepan") ;; Uskrs i Duhovi (holiday-filter-visible-calendar (mapcar (lambda (dag) (list (calendar-gregorian-from-absolute (+ (hr-easter displayed-year) (car dag))) (cadr dag))) '(( -2 "Veliki petak") ( -1 "Velika subota") ( 0 "Uskrs") ( +1 "Uskrsni ponedjeljak") ( +39 "Tijelovo") ( +49 "Duhovi") ( +50 "Duhovski ponedjeljak")))))) (setq holiday-other-holidays '((holiday-fixed 2 14 "Valentinovo") (holiday-fixed 3 8 "Internactionalni dan žena") ;; Još uskrsa (holiday-filter-visible-calendar (mapcar (lambda (dag) (list (calendar-gregorian-from-absolute (+ (hr-easter displayed-year) (car dag))) (cadr dag))) (if hr-hide-some-holidays '(( -3 "Veliki četvrtak")) '(( -7 "Cvjetnica") ( -3 "Veliki četvrtak"))))) (unless hr-hide-some-holidays (holiday-fixed 4 1 "Prvi april")) (holiday-float 5 0 -1 "Dan majki") (holiday-fixed 10 24 "Dan Ujedinjenih Nacija") (holiday-float 11 0 2 "Dan očeva") (holiday-fixed 11 10 "Martinje") (holiday-float 12 0 -4 "Prvi advent" 24) (holiday-float 12 0 -3 "Drugi advent" 24) (holiday-float 12 0 -2 "Treći advent" 24) (holiday-float 12 0 -1 "Četvrti advent" 24) (holiday-fixed 12 10 "Nobelov dan") (holiday-fixed 12 13 "Dan Svete Lucije") (holiday-fixed 12 24 "Božić") (holiday-fixed 12 31 "Novogodišnja večer"))) (setq holiday-solar-holidays (if hr-hide-some-holidays nil '((if (fboundp 'atan) (solar-equinoxes-solstices)) (if (progn (require 'cal-dst) t) (funcall 'holiday-sexp calendar-daylight-savings-starts '(format "Ljetno vrijeme počinje %s" (if (fboundp 'atan) (solar-time-string (/ calendar-daylight-savings-starts-time (float 60)) calendar-standard-time-zone-name) "")))) (funcall 'holiday-sexp calendar-daylight-savings-ends '(format "Zimsko vrijeme počinje %s" (if (fboundp 'atan) (solar-time-string (/ calendar-daylight-savings-ends-time (float 60)) calendar-daylight-time-zone-name) "")))))) (setq calendar-holidays (append holiday-general-holidays holiday-local-holidays holiday-other-holidays holiday-solar-holidays)) (provide 'calendar-hr) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-05 11:51 ` Stefan Kangas 2021-07-05 13:00 ` Teemu Likonen 2021-07-05 20:58 ` Arthur Miller @ 2021-07-06 7:55 ` Teemu Likonen 2021-07-06 9:38 ` Arthur Miller 2021-07-06 12:20 ` Stefan Kangas 2 siblings, 2 replies; 16+ messages in thread From: Teemu Likonen @ 2021-07-06 7:55 UTC (permalink / raw) To: Stefan Kangas, Arthur Miller; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 472 bytes --] * 2021-07-05 13:51:42+0200, Stefan Kangas wrote: > Perhaps we could set it up as a GNU ELPA core package? For calendar holidays I think an Elpa repository is the best platform because calendars need to be checked (and possibly updated) yearly about. New national conventions can be published any time. That is different from Emacs release cycle. -- /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 251 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 7:55 ` Teemu Likonen @ 2021-07-06 9:38 ` Arthur Miller 2021-07-06 10:30 ` Teemu Likonen 2021-07-06 12:20 ` Stefan Kangas 1 sibling, 1 reply; 16+ messages in thread From: Arthur Miller @ 2021-07-06 9:38 UTC (permalink / raw) To: Teemu Likonen; +Cc: Stefan Kangas, emacs-devel Teemu Likonen <tlikonen@iki.fi> writes: > * 2021-07-05 13:51:42+0200, Stefan Kangas wrote: > >> Perhaps we could set it up as a GNU ELPA core package? > > For calendar holidays I think an Elpa repository is the best platform > because calendars need to be checked (and possibly updated) yearly > about. New national conventions can be published any time. That is > different from Emacs release cycle. Doesn't calculations suffice? What has to be updated yearly? ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 9:38 ` Arthur Miller @ 2021-07-06 10:30 ` Teemu Likonen 2021-07-06 13:38 ` Arthur Miller 0 siblings, 1 reply; 16+ messages in thread From: Teemu Likonen @ 2021-07-06 10:30 UTC (permalink / raw) To: Arthur Miller; +Cc: Stefan Kangas, emacs-devel [-- Attachment #1: Type: text/plain, Size: 1321 bytes --] * 2021-07-06 11:38:49+0200, Arthur Miller wrote: > Teemu Likonen <tlikonen@iki.fi> writes: >> For calendar holidays I think an Elpa repository is the best platform >> because calendars need to be checked (and possibly updated) yearly >> about. New national conventions can be published any time. That is >> different from Emacs release cycle. > > Doesn't calculations suffice? What has to be updated yearly? Anything. Calendar holidays are politics. For example, in Finland there appeared "Jean Sibeliuksen päivä" (for the composer Jean Sibelius) in 2011. "Suomen luonnon päivä" appeared in 2020. "Lapsen oikeuksien päivä" was a normal holiday before but since 2020 it is recommended to raise the Finnish national flag too. These kind of things can happen any time. My "yearly" was only an approximation because I think new national calendars are published yearly. For Emacs calendar maintainers it is good idea to check (and possibly update) their calendar code at least yearly. Not to forget that the calendar cycle can be different in some countries or cultures. All this says that it is best to publish national and other cultural calendars separately from Emacs releases. -- /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 251 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 10:30 ` Teemu Likonen @ 2021-07-06 13:38 ` Arthur Miller 2021-07-06 16:38 ` Stefan Kangas 0 siblings, 1 reply; 16+ messages in thread From: Arthur Miller @ 2021-07-06 13:38 UTC (permalink / raw) To: Teemu Likonen; +Cc: Stefan Kangas, emacs-devel Teemu Likonen <tlikonen@iki.fi> writes: > * 2021-07-06 11:38:49+0200, Arthur Miller wrote: > >> Teemu Likonen <tlikonen@iki.fi> writes: >>> For calendar holidays I think an Elpa repository is the best platform >>> because calendars need to be checked (and possibly updated) yearly >>> about. New national conventions can be published any time. That is >>> different from Emacs release cycle. >> >> Doesn't calculations suffice? What has to be updated yearly? > > Anything. Calendar holidays are politics. For example, in Finland there > appeared "Jean Sibeliuksen päivä" (for the composer Jean Sibelius) in > 2011. "Suomen luonnon päivä" appeared in 2020. "Lapsen oikeuksien päivä" > was a normal holiday before but since 2020 it is recommended to raise > the Finnish national flag too. > > These kind of things can happen any time. My "yearly" was only an > approximation because I think new national calendars are published > yearly. For Emacs calendar maintainers it is good idea to check (and > possibly update) their calendar code at least yearly. Not to forget that > the calendar cycle can be different in some countries or cultures. > > All this says that it is best to publish national and other cultural > calendars separately from Emacs releases. Ah, ok, yes I understand what you mean. Seen this in all the former republic and now independent countries from Yugoslavia. But I guess, that's still not that overly frequent? ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 13:38 ` Arthur Miller @ 2021-07-06 16:38 ` Stefan Kangas 2021-07-06 17:23 ` Arthur Miller 0 siblings, 1 reply; 16+ messages in thread From: Stefan Kangas @ 2021-07-06 16:38 UTC (permalink / raw) To: Arthur Miller; +Cc: Emacs developers Arthur Miller <arthur.miller@live.com> writes: > > All this says that it is best to publish national and other cultural > > calendars separately from Emacs releases. > > Ah, ok, yes I understand what you mean. Seen this in all the former > republic and now independent countries from Yugoslavia. > > But I guess, that's still not that overly frequent? It's not frequent, but when it happens you really do want it updated ASAP if you are planning to use the calendar. Missing a holiday can mean you're in for some nasty planning surprises (speaking from own experience). I repeat myself here, but I think a core package is the best option. The second best option is to not ship it with Emacs but find out a good naming scheme and put several such packages on GNU ELPA. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 16:38 ` Stefan Kangas @ 2021-07-06 17:23 ` Arthur Miller 2021-07-07 14:31 ` Filipp Gunbin 0 siblings, 1 reply; 16+ messages in thread From: Arthur Miller @ 2021-07-06 17:23 UTC (permalink / raw) To: Stefan Kangas; +Cc: Emacs developers Stefan Kangas <stefan@marxist.se> writes: > Arthur Miller <arthur.miller@live.com> writes: > >> > All this says that it is best to publish national and other cultural >> > calendars separately from Emacs releases. >> >> Ah, ok, yes I understand what you mean. Seen this in all the former >> republic and now independent countries from Yugoslavia. >> >> But I guess, that's still not that overly frequent? > > It's not frequent, but when it happens you really do want it updated > ASAP if you are planning to use the calendar. Missing a holiday can > mean you're in for some nasty planning surprises (speaking from own > experience). > > I repeat myself here, but I think a core package is the best option. > The second best option is to not ship it with Emacs but find out a > good naming scheme and put several such packages on GNU ELPA. I have no problem with this being either in Elpa or Emacs. I was just reflecting over the problem :). However, I was thinking yesterday about um-marrying day and month name strings from hollidays. Would it be an idea to have those array for names in separate files from hollidays and maybe shipped with Emacs. I can machine-generate those for ~200 languages, and they are really small. I am thinking of a file structure like: "lisp/calendar/locale/". In locale directory would be one file per language named something like "names-countrycode.el" (for example names-fi.el, names-sv.el, names-ar.el etc). A content would be just names of days and months. Content of each file would like in code belove the email. Calendar could than just load appropriate file to set localized names and it could be done when calendar is loaded. I am not sure if I can extract format string for dates as well. I had some time today so I did small script to extract this data from ICU locale databas. As I understand the license, they permit any use of both data and code: https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE I really use just a very small subset of their data from their locale dir: https://github.com/unicode-org/icu/tree/main/icu4c/source/data/locales Unfortunately some of locales are not bit more complicated to obtain, so I don't have all languages, but quite many. If we could have database of names for days and months in Emacs, then only hollidays should need separate packaging. Would that be something to have? I haven't patched calendar.el yet, but it shouldn't be difficult to do that, can see tomorrow. #+begin_src emacs-lisp ;; names-sv.el (setq calendar-day-name-array ["söndag" "måndag" "tisdag" "onsdag" "torsdag" "fredag" "lördag"] calendar-day-abbrev-array ["sön" "mån" "tis" "ons" "tors" "fre" "lör"] calendar-day-format-array ["söndag" "måndag" "tisdag" "onsdag" "torsdag" "fredag" "lördag"] calendar-day-header-array ["sö" "må" "ti" "on" "to" "fr" "lö"]) (setq calendar-month-name-array ["januari" "februari" "mars" "april" "maj" "juni" "juli" "augusti" "september" "oktober" "november" "december"] calendar-month-format-array ["januari" "februari" "mars" "april" "maj" "juni" "juli" "augusti" "september" "oktober" "november" "december"] calendar-month-abbrev-array ["jan." "feb." "mars" "apr." "maj" "juni" "juli" "aug." "sep." "okt." "nov." "dec."]) ;; names-fi.el (setq calendar-day-name-array ["sunnuntai" "maanantai" "tiistai" "keskiviikko" "torstai" "perjantai" "lauantai"] calendar-day-abbrev-array ["su" "ma" "ti" "ke" "to" "pe" "la"] calendar-day-format-array ["sunnuntaina" "maanantaina" "tiistaina" "keskiviikkona" "torstaina" "perjantaina" "lauantaina"] calendar-day-header-array ["su" "ma" "ti" "ke" "to" "pe" "la"]) (setq calendar-month-name-array ["tammikuu" "helmikuu" "maaliskuu" "huhtikuu" "toukokuu" "kesäkuu" "heinäkuu" "elokuu" "syyskuu" "lokakuu" "marraskuu" "joulukuu"] calendar-month-format-array ["tammikuuta" "helmikuuta" "maaliskuuta" "huhtikuuta" "toukokuuta" "kesäkuuta" "heinäkuuta" "elokuuta" "syyskuuta" "lokakuuta" "marraskuuta" "joulukuuta"] calendar-month-abbrev-array ["tammik." "helmik." "maalisk." "huhtik." "toukok." "kesäk." "heinäk." "elok." "syysk." "lokak." "marrask." "jouluk."]) ;; names-hr.el (setq calendar-day-name-array ["nedjelja" "ponedjeljak" "utorak" "srijeda" "četvrtak" "petak" "subota"] calendar-day-abbrev-array ["ned" "pon" "uto" "sri" "čet" "pet" "sub"] calendar-day-format-array ["nedjelja" "ponedjeljak" "utorak" "srijeda" "četvrtak" "petak" "subota"] calendar-day-header-array ["ned" "pon" "uto" "sri" "čet" "pet" "sub"]) (setq calendar-month-name-array ["siječanj" "veljača" "ožujak" "travanj" "svibanj" "lipanj" "srpanj" "kolovoz" "rujan" "listopad" "studeni" "prosinac"] calendar-month-format-array ["siječnja" "veljače" "ožujka" "travnja" "svibnja" "lipnja" "srpnja" "kolovoza" "rujna" "listopada" "studenoga" "prosinca"] calendar-month-abbrev-array ["sij" "velj" "ožu" "tra" "svi" "lip" "srp" "kol" "ruj" "lis" "stu" "pro"]) ;; names-ar.el (setq calendar-day-name-array ["الأحد" "الاثنين" "الثلاثاء" "الأربعاء" "الخميس" "الجمعة" "السبت"] calendar-day-abbrev-array ["الأحد" "الاثنين" "الثلاثاء" "الأربعاء" "الخميس" "الجمعة" "السبت"] calendar-day-format-array ["الأحد" "الاثنين" "الثلاثاء" "الأربعاء" "الخميس" "الجمعة" "السبت"] calendar-day-header-array ["أحد" "إثنين" "ثلاثاء" "أربعاء" "خميس" "جمعة" "سبت"]) (setq calendar-month-name-array ["يناير" "فبراير" "مارس" "أبريل" "مايو" "يونيو" "يوليو" "أغسطس" "سبتمبر" "أكتوبر" "نوفمبر" "ديسمبر"] calendar-month-format-array ["يناير" "فبراير" "مارس" "أبريل" "مايو" "يونيو" "يوليو" "أغسطس" "سبتمبر" "أكتوبر" "نوفمبر" "ديسمبر"] calendar-month-abbrev-array ["يناير" "فبراير" "مارس" "أبريل" "مايو" "يونيو" "يوليو" "أغسطس" "سبتمبر" "أكتوبر" "نوفمبر" "ديسمبر"]) #+end_src ± |master S:1 U:1 ?:169 ✗| → ls locale names-af.el names-bo.el names-doi.el names-fil.el names-hsb.el names-kam.el names-ku.el names-mer.el names-naq.el names-ps.el names-se.el names-ta.el names-wae.el names-agq.el names-br.el names-dsb.el names-fo.el names-hu.el names-kde.el names-kw.el names-mfe.el names-nb.el names-pt.el names-seh.el names-te.el names-vai.el names-ak.el names-brx.el names-dua.el names-fr.el names-hy.el names-kea.el names-ky.el names-mg.el names-nd.el names-qu.el names-ses.el names-teo.el names-vi.el names-am.el names-bs.el names-dyo.el names-fur.el names-ia.el names-khq.el names-lag.el names-mgh.el names-ne.el names-rm.el names-sg.el names-tg.el names-wo.el names-ar.el names-ca.el names-dz.el names-fy.el names-id.el names-ki.el names-lb.el names-mgo.el names-nl.el names-rn.el names-sh.el names-th.el names-vun.el names-ars.el names-ccp.el names-ebu.el names-ga.el names-ig.el names-kk.el names-lg.el names-mi.el names-nmg.el names-ro.el names-shi.el names-ti.el names-xh.el names-asa.el names-ceb.el names-ee.el names-gd.el names-ii.el names-kkj.el names-lkt.el names-mk.el names-nn.el names-rof.el names-si.el names-tk.el names-xog.el names-as.el names-ce.el names-el.el names-gl.el names-in.el names-kl.el names-ln.el names-ml.el names-nnh.el names-root.el names-sk.el names-tl.el names-yav.el names-ast.el names-cgg.el names-en.el names-gsw.el names-is.el names-kln.el names-lo.el names-mn.el names-no.el names-ru.el names-sl.el names-to.el names-yi.el names-az.el names-chr.el names-eo.el names-gu.el names-it.el names-km.el names-lrc.el names-mni.el names-nus.el names-rw.el names-smn.el names-tr.el names-yo.el names-bas.el names-ckb.el names-es.el names-guz.el names-iw.el names-kn.el names-lt.el names-mo.el names-nyn.el names-rwk.el names-sn.el names-tt.el names-yue.el names-be.el names-cs.el names-et.el names-gv.el names-ja.el names-ko.el names-lu.el names-mr.el names-om.el names-sa.el names-so.el names-twq.el names-zgh.el names-bem.el names-cy.el names-eu.el names-ha.el names-jgo.el names-kok.el names-luo.el names-ms.el names-or.el names-sah.el names-sq.el names-tzm.el names-zh.el names-bez.el names-da.el names-ewo.el names-haw.el names-jmc.el names-ksb.el names-luy.el names-mt.el names-os.el names-saq.el names-sr.el names-ug.el names-zu.el names-bg.el names-dav.el names-fa.el names-he.el names-jv.el names-ks.el names-lv.el names-mua.el names-pa.el names-sat.el names-su.el names-uk.el names-bm.el names-de.el names-ff.el names-hi.el names-kab.el names-ksf.el names-mai.el names-my.el names-pcm.el names-sbp.el names-sv.el names-ur.el names-bn.el names-dje.el names-fi.el names-hr.el names-ka.el names-ksh.el names-mas.el names-mzn.el names-pl.el names-sd.el names-sw.el names-uz.el ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 17:23 ` Arthur Miller @ 2021-07-07 14:31 ` Filipp Gunbin 2021-07-08 2:23 ` Arthur Miller 0 siblings, 1 reply; 16+ messages in thread From: Filipp Gunbin @ 2021-07-07 14:31 UTC (permalink / raw) To: Arthur Miller; +Cc: Stefan Kangas, Emacs developers > Would it be an idea to have those array for names in separate > files from hollidays and maybe shipped with Emacs. I can > machine-generate those for ~200 languages, and they are really small. I > am thinking of a file structure like: "lisp/calendar/locale/". In locale > directory would be one file per language named something like > "names-countrycode.el" (for example names-fi.el, names-sv.el, > names-ar.el etc). A content would be just names of days and > months. Content of each file would like in code belove the email. There're countries in which multiple languages are in use, so it's not sufficient to map country code to a file. Rather, a language should be mapped to a file. Maybe you need something like locale-language-names var, see its doc. Filipp ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-07 14:31 ` Filipp Gunbin @ 2021-07-08 2:23 ` Arthur Miller 2021-07-08 14:27 ` Filipp Gunbin 0 siblings, 1 reply; 16+ messages in thread From: Arthur Miller @ 2021-07-08 2:23 UTC (permalink / raw) To: Filipp Gunbin; +Cc: Stefan Kangas, Emacs developers Filipp Gunbin <fgunbin@fastmail.fm> writes: >> Would it be an idea to have those array for names in separate >> files from hollidays and maybe shipped with Emacs. I can >> machine-generate those for ~200 languages, and they are really small. I >> am thinking of a file structure like: "lisp/calendar/locale/". In locale >> directory would be one file per language named something like >> "names-countrycode.el" (for example names-fi.el, names-sv.el, >> names-ar.el etc). A content would be just names of days and >> months. Content of each file would like in code belove the email. > > There're countries in which multiple languages are in use, so it's not > sufficient to map country code to a file. Rather, a language should be > mapped to a file. Yes, of course, that is what I actually meant, a file per language, but wrote clumsy in speed country. If you check ls output from folder with generated languages or pasted code, these are language files, not country files: for example names-ar.el is for arabic language, names-sv is for swedish etc. There are entire iso standards to deal with locales, their names etc and I don't think that calendar.el needs to implement entire ICU. I just wish to automate parts that can be easily automated. @Stefan, those files could be distributed as an Elpa package, they don't need to be shipped with Emacs itself. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-08 2:23 ` Arthur Miller @ 2021-07-08 14:27 ` Filipp Gunbin 2021-07-09 9:00 ` Arthur Miller 0 siblings, 1 reply; 16+ messages in thread From: Filipp Gunbin @ 2021-07-08 14:27 UTC (permalink / raw) To: Arthur Miller; +Cc: Stefan Kangas, Emacs developers On 08/07/2021 04:23 +0200, Arthur Miller wrote: > There are entire iso standards to deal with locales, their names etc and > I don't think that calendar.el needs to implement entire ICU. I just > wish to automate parts that can be easily automated. What do you mean by implementing entire ICU? I was only writing about having a flexible mapping, like locale-language-names. Filipp ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-08 14:27 ` Filipp Gunbin @ 2021-07-09 9:00 ` Arthur Miller 0 siblings, 0 replies; 16+ messages in thread From: Arthur Miller @ 2021-07-09 9:00 UTC (permalink / raw) To: Filipp Gunbin; +Cc: Stefan Kangas, Emacs developers Filipp Gunbin <fgunbin@fastmail.fm> writes: > On 08/07/2021 04:23 +0200, Arthur Miller wrote: > >> There are entire iso standards to deal with locales, their names etc and >> I don't think that calendar.el needs to implement entire ICU. I just >> wish to automate parts that can be easily automated. > > What do you mean by implementing entire ICU? I was only writing about > having a flexible mapping, like locale-language-names. > I didn't said that you have said it either :). It wasn't about you at all. I was reflecting over me picking up names from their database, and reflecting over that it is a ginormous database which have lots and lots of useful locale things, but which calendar.el don't need. Otherwise, a C binding to icu library would probably better and easier to implement than translating the database to lisp. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Swedish calendar localization in official release (sv-kalender.el)? 2021-07-06 7:55 ` Teemu Likonen 2021-07-06 9:38 ` Arthur Miller @ 2021-07-06 12:20 ` Stefan Kangas 1 sibling, 0 replies; 16+ messages in thread From: Stefan Kangas @ 2021-07-06 12:20 UTC (permalink / raw) To: Teemu Likonen; +Cc: Arthur Miller, Emacs developers Teemu Likonen <tlikonen@iki.fi> writes: > > Perhaps we could set it up as a GNU ELPA core package? > > For calendar holidays I think an Elpa repository is the best platform > because calendars need to be checked (and possibly updated) yearly > about. New national conventions can be published any time. That is > different from Emacs release cycle. Having it as a core package means that we can have the best of both worlds though: it is in Emacs, and newer versions are installable from GNU ELPA. ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-07-09 9:00 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-07-04 11:40 Swedish calendar localization in official release (sv-kalender.el)? Arthur Miller 2021-07-05 11:51 ` Stefan Kangas 2021-07-05 13:00 ` Teemu Likonen 2021-07-05 21:02 ` Arthur Miller 2021-07-05 20:58 ` Arthur Miller 2021-07-06 7:55 ` Teemu Likonen 2021-07-06 9:38 ` Arthur Miller 2021-07-06 10:30 ` Teemu Likonen 2021-07-06 13:38 ` Arthur Miller 2021-07-06 16:38 ` Stefan Kangas 2021-07-06 17:23 ` Arthur Miller 2021-07-07 14:31 ` Filipp Gunbin 2021-07-08 2:23 ` Arthur Miller 2021-07-08 14:27 ` Filipp Gunbin 2021-07-09 9:00 ` Arthur Miller 2021-07-06 12:20 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).