Berakhot 9:5 Halakha : Mishneh Torah, Blessings

חַיָּב אָדָם לְבָרֵךְ עַל הָרָעָה כְּשֵׁם שֶׁהוּא מְבָרֵךְ עַל הַטּוֹבָה, שֶׁנֶּאֱמַר (דברים ו) וְאָהַבְתָּ אֵת יְיָ אֱלֹהֶיךָ בְּכָל לְבָבְךָ וּבְכָל נַפְשְׁךָ וּבְכָל מְאֹדֶךָ. בְּכָל לְבָבְךָ, בִּשְׁנֵי יְצָרֶיךָ, בְּיֵצֶר טוֹב וּבְיֵצֶר רָע. וּבְכָל נַפְשְׁךָ, אֲפִלּוּ הוּא נוֹטֵל אֶת נַפְשֶׁךָ. וּבְכָל מְאֹדֶךָ, בְּכָל מָמוֹנֶךָ. דָּבָר אַחֵר בְּכָל מְאֹדֶךָ, בְּכָל מִדָּה וּמִדָּה שֶׁהוּא מוֹדֵד לְךָ הֱוֵי מוֹדֶה לוֹ בִּמְאֹד מְאֹד. לֹא יָקֵל אָדָם אֶת רֹאשׁוֹ כְּנֶגֶד שַׁעַר הַמִּזְרָח, שֶׁהוּא מְכֻוָּן כְּנֶגֶד בֵּית קָדְשֵׁי הַקָּדָשִׁים. לֹא יִכָּנֵס לְהַר הַבַּיִת בְּמַקְלוֹ, וּבְמִנְעָלוֹ, וּבְפֻנְדָּתוֹ, וּבְאָבָק שֶׁעַל רַגְלָיו, וְלֹא יַעֲשֶׂנּוּ קַפַּנְדַּרְיָא, וּרְקִיקָה מִקַּל וָחֹמֶר. כָּל חוֹתְמֵי בְרָכוֹת שֶׁהָיוּ בַמִּקְדָּשׁ, הָיוּ אוֹמְרִים מִן הָעוֹלָם. מִשֶּׁקִּלְקְלוּ הַמִּינִין, וְאָמְרוּ, אֵין עוֹלָם אֶלָּא אֶחָד, הִתְקִינוּ שֶׁיְּהוּ אוֹמְרִים, מִן הָעוֹלָם וְעַד הָעוֹלָם. וְהִתְקִינוּ, שֶׁיְּהֵא אָדָם שׁוֹאֵל אֶת שְׁלוֹם חֲבֵרוֹ בַּשֵּׁם, שֶׁנֶּאֱמַר (רות ב) וְהִנֵּה בֹעַז בָּא מִבֵּית לֶחֶם, וַיֹּאמֶר לַקּוֹצְרִים יְיָ עִמָּכֶם, וַיֹּאמְרוּ לוֹ, יְבָרֶכְךָ יְיָ. וְאוֹמֵר (שופטים ו) יְיָ עִמְּךָ גִּבּוֹר הֶחָיִל. וְאוֹמֵר (משלי כג) אַל תָּבוּז כִּי זָקְנָה אִמֶּךָ. וְאוֹמֵר (תהלים קיט) עֵת לַעֲשׂוֹת לַייָ הֵפֵרוּ תוֹרָתֶךָ. רַבִּי נָתָן אוֹמֵר, הֵפֵרוּ תוֹרָתֶךָ עֵת לַעֲשׂוֹת לַייָ:

Il faut bénir Dieu pour le mal comme pour le bien, car il est dit: Tu aimeras Dieu de tout ton cœur, de toute ton âme et de toutes tes facultés (Dt 6, 5); de tout ton cœur signifie: de tes deux instincts, le bon et le mauvais; de toute ton âme: si même on te l’arrache; et de toutes tes facultés veut dire: pour toute ta fortune. Selon d’autres, ces mots signifient: Selon la mesure que Dieu t’accorde (bonne ou mauvaise), rends-lui grâce de plus en plus.

Mishneh Torah, Blessings

On hearing good news, one says, "Blessed art thou, O Lord our God, King of the Universe, Who art good, and doest good." On hearing evil tidings, one says, "Blessed be the true judge." A person has to bless God with good will, for ill fortune, just as he has to bless Him with joy for good fortune, as it is said "And thou shalt love the Lord thy God with all thine heart, with all thy soul and with all thy might." (Deuteronomy 6:5). In the abounding love of God enjoined upon us, it is implied that even in distress, one should thank and praise Him with joy.