[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] ebdb-bits efc7799: Add internationalized ebdb-string method for C
From: |
Eric Abrahamsen |
Subject: |
[elpa] ebdb-bits efc7799: Add internationalized ebdb-string method for Chinese addresses |
Date: |
Sun, 13 Aug 2017 16:24:02 -0400 (EDT) |
branch: ebdb-bits
commit efc7799c359a36113263a4437cc9809127476922
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Add internationalized ebdb-string method for Chinese addresses
* packages/ebdb-i18n-chn/ebdb-i18n-chn.el (ebdb-string-i18n): Format
Chinese addresses correctly.
---
packages/ebdb-i18n-chn/ebdb-i18n-chn.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/packages/ebdb-i18n-chn/ebdb-i18n-chn.el
b/packages/ebdb-i18n-chn/ebdb-i18n-chn.el
index 2a8c68e..7fd80ac 100644
--- a/packages/ebdb-i18n-chn/ebdb-i18n-chn.el
+++ b/packages/ebdb-i18n-chn/ebdb-i18n-chn.el
@@ -66,6 +66,20 @@
(string-to-number (match-string 1 num-str)))))
(apply #'make-instance class slots)))
+(cl-defmethod ebdb-string-i18n ((adr ebdb-field-address)
+ (_cc (eql chn)))
+ (if (eql (aref char-script-table (aref (car streets) 0)) 'han)
+ (with-slots (streets locality region postcode) adr
+ (concat
+ ;; There are four municipalities, we don't need to repeat
+ ;; city-plus-province for them.
+ (unless (string-match-p "北京\\|重庆\\|上海\\|天津" region)
+ region)
+ locality
+ (mapconcat #'identity streets "")
+ ", " postcode))
+ (ebdb-format-address address 2)))
+
;; This isn't all of them, but it seems like a reasonable subset. See
;; https://en.wikipedia.org/wiki/Chinese_compound_surname for a fuller
;; list.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] ebdb-bits efc7799: Add internationalized ebdb-string method for Chinese addresses,
Eric Abrahamsen <=