branch: externals/ebdb
commit 26d632b00ba4b11e38698b11f06478e7791c11ba
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Finish ebdb-internationalize-addresses
* ebdb-i18n.el (ebdb-internationalize-addresses): This function wasn't
actually written before.
---
ebdb-i18n.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/ebdb-i18n.el b/ebdb-i18n.el
index b94e9cd..ec54dc1 100644
--- a/ebdb-i18n.el
+++ b/ebdb-i18n.el
@@ -662,7 +662,19 @@ This method should return a new instance of CLASS.")
address fields.
Essentially this just means swapping out the string country names
-for their symbol representations.")
+for their symbol representations."
+ (let ((count 0))
+ (dolist (rec (ebdb-records))
+ (dolist (adr (ebdb-record-address rec))
+ (when (stringp (slot-value adr 'country))
+ (ignore-errors
+ (ebdb-record-change-field
+ rec adr
+ (clone adr :country
+ (cdr (assoc-string (slot-value adr 'country)
+ (ebdb-i18n-countries)))))
+ (cl-incf count)))))
+ (message "Internationalized %d addresses" count)))
(cl-defmethod ebdb-read :extra "i18n" ((class (subclass ebdb-field-address))
&optional slots obj)