Class: TranslationsGenerator
- Inherits:
-
Object
- Object
- TranslationsGenerator
- Defined in:
- lib/vipassana/translations_generator.rb
Overview
This file is used to generate the i18n.js file which will be used by the website to generate on he fly on the logos in the various languages
Instance Method Summary collapse
-
#initialize ⇒ TranslationsGenerator
constructor
A new instance of TranslationsGenerator.
- #run ⇒ Object
- #update_locale(locale) ⇒ Object
Constructor Details
#initialize ⇒ TranslationsGenerator
Returns a new instance of TranslationsGenerator.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/vipassana/translations_generator.rb', line 4 def initialize @vipassana_meditation = [ ["bg", "Випассана Медитация"], ["cs", "Meditace Vipassana"], ["de", "Vipassana Meditation"], ["el", "Βιπάσσανα Διαλογισμός"], ["en", "Vipassana Meditation"], ["es", "Meditación Vipassana"], ["fa", "ویپاسانا مراقبه"], ["fi", "Vipassana Meditaatio"], ["fr", "Méditation Vipassana"], ["gu", "વિપશ્યના સાધના"], ["he", "מדיטציית ויפאסנה"], ["hi", "विपश्यना साधना"], ["hu", "Vipassana Meditáció"], ["id", "Vipassana Meditasi"], ["it", "Meditazione Vipassana"], ["ja", "ヴィパッサナー 瞑想"], ["km", "វិបស្សនា កម្មដ្ឋាន"], ["ko", "위빳사나 명상"], ["lt", "Vipasanos Meditacija"], ["lv", "Vipassanas Meditācija"], ["mr", "विपश्यना साधना"], ["nl", "Vipassana Meditatie"], ["or", "ଭିପାସାନା ସାଧନା"], ["pl", "Medytacja Vipassana"], ["pt", "Vipassana Meditação"], ["ro", "Meditatia Vipassana"], ["ru", "Випассана Медитация"], ["si", "විපස්සනා භාවනාව"], ["sv", "Vipassana Meditation"], ["ta", "விபஸ்ஸனா தியானம்"], ["te", "విపశ్యన ధ్యానం"], ["th", "การปฏิบัติวิปัสสนา กรรมฐาน"], ["tr", "Vipassana Meditasyonu"], ["vi", "Thiền Vipassana"], ["zh-HANS", "内 观 静 坐"], ["zh-HANT", "內 觀 靜 坐"]].to_h @as_taught = [ ["bg", "както се Преподава от С.Н. Гоенка"], ["cs", "jak ji Vyučoval S.N. Goenka"], ["de", "wie Gelehrt von S.N. Goenka"], ["el", "Όπως διδάσκεται από τον S.N. Goenka"], ["en", "as Taught by S.N. Goenka"], ["es", "tal y como la Enseña S.N.Goenka"], ["fa", "همانگونه که توسط س. ن. گوینکا آموزش داده شده"], ["fi", "S.N. Goenkan opettamana"], ["fr", "telle qu'enseignée par S.N. Goenka"], ["gu", "સયાજી ઉ બા ખિનની પરંપરામાં"], ["he", "כפי שמלמד ס.נ. גואנקה"], ["hi", "सत्यनारायण गोयन्काजी द्वारा सिखायी गयी"], ["hu", "S.N. Goenka Tanítása szerint"], ["id", "sebagaimana Diajarkan oleh S.N. Goenka"], ["it", "come Insegnata da S.N. Goenka"], ["ja", "サヤジ・ウ・バ・キンの伝統のもと"], ["km", "បង្រៀនដោយលោក ស.ន. ហ្គោឥនកា"], ["ko", "고엥까 선생님이 가르치는"], ["lt", "kaip jos Mokė S.N. Goenka"], ["lv", "kā to Pasniedz S.N. Goenka"], ["mr", "सत्यनारायण गोएंका द्वारा जशी शिकविली जाते"], ["nl", "zoals Onderwezen door S.N. Goenka"], ["or", "ଯେହେତୁ ଏସ.ଏନ ଗୋଏଙ୍କା"], ["pl", "Nauczana przez S.N.Goenkę"], ["pt", "como Ensinada por S.N. Goenka"], ["ro", "asa cum este Predata de S.N.Goenka"], ["ru", "как ее Преподает С.Н. Гоенка"], ["si", "එස් එන්. ගොඑන්කා විසින් උගන්වනු ලබන පරිදි"], ["sv", "som den Lärs ut av S.N. Goenka"], ["ta", "ஸயாஜி ஊ பா கின் அவர்களின் வழிமரபில்"], ["te", "శ్రీ గోయెంక గారిచే భోదించబడిన"], ["th", "สอนโดยท่านอาจารย์โกเอ็นก้า"], ["tr", "S.N. Goenka tarafından Öğretilen"], ["vi", "do Thiền sư S.N. Goenka Giảng Dạy"], ["zh-HANS", "由葛印卡老师所教"], ["zh-HANT", "由葛印卡老師所教"]].to_h @in_the_tradition = [ ["bg", "в Традицията на Саяджи У Ба Кин"], ["cs", "podle Tradice Sayagyi U Ba Khin"], ["de", "in der Tradition von Sayagyi U Ba Khin"], ["el", "σύμφωνα με την παράδοση του Sayagyi U Ba Khin"], ["en", "in the Tradition of Sayagyi U Ba Khin"], ["es", "en la Tradición de Sayagyi U Ba Khin"], ["fa", "بر اساس سنت سیاجی او باکین"], ["fi", "Sayagyi U Ba Khinin Traditiossa"], ["fr", "dans la Tradition de Sayagyi U Ba Khin"], ["gu", "આચાર્ય ગોયન્કાજી દ્વારા શીખવવામાં આવતી વિપશ્યના સાધના"], ["he", "במסורתו של סיאג<span style=\"line-height: 20.8px;\">’</span>י או-בה-קין"], ["hi", "सयाजी ऊ बा खिन की परंपरा मैं"], ["hu", "Sayagyi U Ba Khin Hagyományvonalán"], ["id", "dalam Tradisi Sayagyi U Ba Khin"], ["it", "nella Tradizione di Sayagyi U Ba Khin"], ["ja", "S.N.ゴエンカの指導による"], ["km", "តាមប្រពៃណីរបស់លោក សាយាគ្យី អ៊ូបាឃិន"], ["ko", "사야지 우 바 킨 스승의 전통에 따라"], ["lt", "pagal Sayagyi U Ba Khino Tradiciją"], ["lv", "Sayagyi U Ba Khina tradīcijā"], ["mr", "आचार्य गोयन्काजी द्वारा शिकविली जाणारी विपश्यना साधना"], ["nl", "in de Traditie van Sayagyi U Ba Khin"], ["or", "ସାୟାଗି ୟୁ ବା ଖିନଙ୍କ ପରମ୍ପରାରେ"], ["pl", "w Tradycji Sayagyi U Ba Khina"], ["pt", "na Tradição de Sayagyi U Ba Khin"], ["ro", "in Traditia lui Sayagyi U Ba Khin"], ["ru", "в Традиции Саяджи У Ба Кхина"], ["si", "සයාජී ඌ බා කින් තුමාගේ සම්ප්රදායට අනුව"], ["sv", "i Sayagyi U Ba Khins Tradition"], ["ta", "திரு. ச.நா. கோயங்கா அவர்களால் கற்பிக்கப்பட்ட முறை"], ["te", "సాయజి ఉ బ ఖిన్ గారి సంప్రదాయంలో"], ["th", "ในแนวทางของท่านซายาจี อูบาขิ่น"], ["tr", "Sayagyi U Ba Khin Geleneğinde"], ["vi", "theo Truyền thống của Sayagyi U Ba Khin"], ["zh-HANS", "传承自乌巴庆老师"], ["zh-HANT", "傳承自烏巴慶老师"]].to_h @full = [ ["bg", "Випассана Медитация, както се преподава от С. Н. Гоенка, в традицията на Саяджи У Ба Кин"], ["cs", "Meditace vipassana, jak ji vyučuje S. N. Goenka\n" + "podle tradice Sayagyi U Ba Khina"], ["de", "Vipassana Meditation wie gelehrt von S.N. Goenka in der Tradition von Sayagyi U Ba Khin"], ["el", "Διαλογισμός Βιπάσσανα όπως διδάσκεται από τον S.N.Goenka και τους βοηθούς του, \n" + "κατά την παράδοση του Sayagyi U Ba Khin"], ["en", "Vipassana Meditation As Taught By S.N. Goenka in the tradition of Sayagyi U Ba Khin"], ["es", "Meditación Vipassana tal y como la enseña S.N. Goenka en la tradición de Sayagyi U Ba Khin"], ["fa", "مراقبه ویپاسانا با روش آموزش س. ن. گوینکا در سنت سایاجی اوباکین"], ["fi", "Vipassanameditaatio S.N. Goenkan opettamana, Sayagyi U Ba Khinin traditiossa"], ["fr", "Méditation Vipassana telle qu'enseignée par S.N.Goenka dans la tradition de Sayagyi U Ba Khin"], ["gu", "સયાજી ઉ બા ખિનની પરંપરામાં\n" + "આચાર્ય ગોયન્કાજી દ્વારા શીખવવામાં આવતી વિપશ્યના સાધના"], ["he", "מדיטציית ויפאסנה כפי שמלמד ס.נ. גואנקה במסורתו של סיאג'י או בה קין"], ["hi", "सयाजी उ बा खिन की परंपरा में \n" + "आचार्य गोयन्काजी द्वारा सिखायी गयी विपश्यना साधना"], ["hu", "Vipassana meditáció S.N. Goenkának a Sayagyi U Ba Khin hagyományvonalán alapuló tanítása szerint"], ["id", "Meditasi Vipassana sebagaimana diajarkan oleh S.N. Goenka dengan tradisi Sayagyi U Ba Khin"], ["it", "Meditazione Vipassana come insegnata da S. N. Goenka nella tradizione di Sayagyi U Ba Khin"], ["ja", "サヤジ・ウ・バ・キンの伝統のもと\n" + "S.N.ゴエンカの指導によるヴィパッサナー瞑想"], ["km", "វិបស្សនាកម្មដ្ឋាន បង្រៀនដោយលោក ស.ន. ហ្គោឥនកា តាមប្រពៃណីរបស់លោក សាយាគ្យី អ៊ូបាឃិន"], ["kn", "ವಿಪಶ್ಯನ ಧ್ಯಾನ - ಶ್ರೀ ಸಯಾಜಿ ಉಬಾಖಿನ್ರ ಸಂಪ್ರದಾಯದಲ್ಲಿ ಶ್ರೀ ಎಸ್.ಎನ್.ಗೋಯಂಕಾರವರು ಬೋಧಿಸಿದಂತೆ"], ["ko", "사야지 우 바 킨의 전통에 따라 S.N. 고엥까 (고엔카) 님이 가르치는 위빳사나 명상"], ["lt", "Vipasanos meditacija pagal S. N. Goenkos mokymą ir Sayagyi U Ba Khino tradiciją"], ["lv", "Vipassanas Meditācija kā to pasniedz S. N. Goenka Sayagyi U Ba Khina tradīcijā"], ["mr", "सयाजी उ बा खिन ह्यांच्या परंपरेत आचार्य गोयन्काजींनी शिकवलेली विपश्यना साधना"], ["nl", "Vipassana Meditatie zoals onderwezen door S.N. Goenka in de traditie van Sayagyi U Ba Khin"], ["or", "ଭିପାସାନା ସାଧନା ଯେପରି ଏସ୍। ସାୟାଗି ୟୁ ବା ଖିନଙ୍କ ପରମ୍ପରାରେ ଗୋଏଙ୍କା |"], ["pl", "Medytacja Vipassana w tradycji Sayagyi U Ba Khina nauczana przez S.N.Goenkę"], ["pt", "Meditação Vipasssana como ensinada por S.N. Goenka\n" + "na tradição de Sayagyi U Ba Khin"], ["pt-BR", "Website.Início.Título"], ["ro", "Meditatia Vipassana asa cum este predata de S.N.Goenka, in traditia lui Sayagyi U Ba Khin"], ["ru", "Медитация випассана как ее преподает С.Н. Гоенка в традиции Саяджи У Ба Кхина"], ["si", "සයාජී ඌ බා කින් තුමාගේ සම්ප්රදායට අනුව එස්. එන්. ගොඑන්කා විසින් උගන්වනු ලබන විපස්සනා භාවනාව"], ["sv", "Vipassanameditation som den lärs ut av S. N. Goenka i Sayagyi U Ba Khins tradition"], ["ta", "ஸயாஜி ஊ பா கின் அவர்களின் வழிமரபில் திரு.ச.நா. கோயங்கா அவர்களால் கற்பிக்கப்படும் விபஸ்ஸனா தியான முறை "], ["te", "సాయజి ఉబాఖిన్ గారి సంప్రదాయంలో, శ్రీ గోయెంక గారు బోధించిన విపశ్యన ధ్యానం."], ["th", "การปฏิบัติวิปัสสนากรรมฐาน สอนโดยท่านอาจารย์โกเอ็นก้า ตามแนวทางของท่านอาจารย์อูบาขิ่น"], ["tr", "Sayagyi U Ba Khin geleneğinde S.N. Goenka tarafından öğretilen Vipassana Meditasyonu"], ["vi", "Thiền Vipassana do Thiền sư S.N. Goenka giảng dạy\n" + "theo truyền thống của Ngài Sayagyi U Ba Khin"], ["zh-HANS", "<p>由葛印卡老师所教导, 传承自乌巴庆老师的内观</p><p> </p>"], ["zh-HANT", "遵循烏巴慶長者所傳、葛印卡老師所教的內觀課程"]].to_h @keys = { "menus.vipassana_meditation" => "1_vipassana_meditation2", "menus.vipassana_meditation2" => "1_vipassana_meditation3", "menus.vipassana_meditation_as_taugh" => "2_as_taught2", "comm.headings.as_taught_by_goenka" => "2_as_taught3", "menus.vipassana_meditation_in_tradition" => "3_in_the_tradition2", "comm.headings.sayagyi_u_ba_khin_tradition" => "3_in_the_tradition3", "menus.vipassana_meditation_subtitle" => "4_full2" } @i18n = {} end |
Instance Method Details
#run ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/vipassana/translations_generator.rb', line 244 def run do_locales = ["bg", "cs", "de", "el", "en", "es", "fa", "fi", "fr", "gu", "he", "hi", "hu", "id", "it", "ja", "km", "ko", "lt", "lv", "mr", "nl", "or", "pl", "pt", "ro", "ru", "si", "sv", "ta", "te", "th", "tr", "vi", "zh-HANS", "zh-HANT" ] calm_locales = Language.extended_gui_translation_codes - ["xx"] locales = (do_locales + calm_locales - ["en"]).uniq @i18n = {} update_locale("en") locales.each { |locale| update_locale(locale) } @i18n end |
#update_locale(locale) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/vipassana/translations_generator.rb', line 221 def update_locale(locale) @i18n[locale] = { "0_language" => Language.find_by_iso_code(locale)&.name, "1_vipassana_meditation" => @vipassana_meditation[locale], "2_as_taught" => @as_taught[locale], "3_in_the_tradition" => @in_the_tradition[locale], "4_full" => @full[locale] } @i18n[locale].reject!{|k,v| v.nil?} @keys.each do |key, prop| value = I18n.t(key, locale: locale, logo: "").gsub(/\s\s/, " ") english = I18n.t(key, locale: "en", logo: "").gsub(/\s\s/, " ") if value.present? && (locale == "en" || value != english) other_value = @i18n[locale][prop.chop] if other_value.blank? || value.downcase != other_value.downcase @i18n[locale][prop] = value end end end @i18n[locale] = @i18n[locale].sort.to_h @i18n[locale] = @i18n[locale].map { |key, value| [key[2..-1], value] }.to_h end |