As we have seen several times now, the
auxiliary verb ようだ is frequently used with verbs, to express that the 'completion' of an action is the specific goal/wish of the speaker. It does this implicitly through the meaning of the kanji 様(よう) 'manner of doing'.
ようにいのる (or 祈(いの)る in its kanji form) is no different, and will imply that the speaker is praying for (A) to be done/completed. This comes from the meaning of the
う-Verb 祈(いの)る itself, which can be translated as 'to pray', or 'to beg'. Despite being able to be used when actually praying, this grammar point is used most often to express a 'hope'.
明日(あした)に雪(ゆき)が降(ふ)って学校(がっこう)が休(やすみ)みになるように祈(いの)る。
I hope that it snows tomorrow and school gets canceled.
世界(せかい)が平和(へいわ)になるように祈(いの)る。
I hope that the world becomes a peaceful place.
In a similar way to other
ように structures, ないように may also be used with 祈(いの)る, to show that someone is praying for something 'not' to happen.
授業中(じゅぎょうちゅう)に先生(せんせい)に呼(よ)ばれないように祈(いの)る。
I hope that the teacher doesn't call on me during class.
友達(ともだち)の車(くるま)に乗(の)る前(まえ)に死(し)なないように祈(いの)る。
I hope that I don't die before I get to ride in my friend's car.
However, 'unlike' other
ように structures,
ように祈(いの)る will sometimes be shortened to
ように by itself. This is especially true after ます.
今年(ことし)は国(くに)に帰(かえ)れますように。
I pray that you can go back to your country this year.
明日(あした)のテストで合格(ごうかく)できますように。
I pray that I can pass tomorrow's test.
This is the only
ように structure that will have the verb that comes after it omitted. Therefore,
ように (by itself) will always mean 'to hope for', and should not be confused with
ようにする,
ようになる,
ようにいう, and other similar grammar points.
といい is also used to express 'to hope for (A)', or 'to wish for (A)'. However, unlike
ように祈(いの)る, the person that the speaker is praying for with
といい will mainly be determined by the use of
ね (praying for someone else), or な (praying for themselves).
行(い)きたい大学(だいがく)に行(い)けるといいね。
I hope that you get into the college that you want to get into. (Hope for your sake)
来年(らいねん)は海外旅行(かいがいりょこう)に行(い)けるといいな。
I hope I can travel abroad next year. (Hope for my own sake)