Commit 9f604744e53084d3137cbc7ac34e99d79a2cf92b
1 parent
2f5d91ba
Exists in
master
Way to support non [a-z0-9] charsets in README.
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -70,6 +70,24 @@ There's also helper for this. To use it, you need: |
70 | 70 | ```ruby |
71 | 71 | letter_avatar_for('ksz2k', 200) |
72 | 72 | ``` |
73 | + | |
74 | +### Way to support non [a-z0-9] charsets | |
75 | + | |
76 | +```rb | |
77 | +class User | |
78 | + def username_for_avatar | |
79 | + # Translate chinese hanzi to pinyin | |
80 | + # https://github.com/flyerhzm/chinese_pinyin | |
81 | + Pinyin.t(self.username) | |
82 | + end | |
83 | +end | |
84 | +``` | |
85 | + | |
86 | +Then you can get right avatar now: | |
87 | + | |
88 | +```rb | |
89 | +letter_avatar_for(user.username_for_avatar, 200) | |
90 | +``` | |
73 | 91 | |
74 | 92 | ## Contributing |
75 | 93 | ... | ... |