Ejemplo n.º 1
0
def get_text_summary(period_content):

    if period_content["MC_role"] == pms.ACHETEUR:

        txt = u"Vous êtes acheteur. L'unité de bien vaut pour vous {}.".format(
            get_pluriel(period_content["MC_value_or_cost"], pms.MONNAIE))

        if period_content["MC_transaction_price"] is not None:
            txt += u" Vous avez acheté à {}.".format(
                get_pluriel(period_content["MC_transaction_price"],
                            pms.MONNAIE))
        else:
            txt += u" Vous n'avez pas fait de transaction."

    else:  # vendeur

        txt = u"Vous êtes vendeur. L'unité de bien vous coûte {}.".format(
            get_pluriel(period_content["MC_value_or_cost"], pms.MONNAIE))

        if period_content["MC_transaction_price"] is not None:
            txt += u" Vous avez vendu à {}.".format(
                get_pluriel(period_content["MC_transaction_price"],
                            pms.MONNAIE))
        else:
            txt += u" Vous n'avez pas fait de transaction."

    txt += u"<br />Votre gain pour la période est de {}.".format(
        get_pluriel(period_content["MC_periodpayoff"], pms.MONNAIE))
    return txt
def get_recapitulatif(period_content):
    texte = trans_CPR(u"You extracted {} and you group extracted a total of {}.\n "
                 u"Your payoff is equal to {}").format(
        get_pluriel(period_content.get("CPR_decision"), trans_CPR(u"token")),
        get_pluriel(period_content.get("CPR_decisiongroup"), trans_CPR(u"token")),
        get_pluriel(period_content.get("CPR_periodpayoff"), u"ecu"))
    return texte
Ejemplo n.º 3
0
def get_text_summary(periods_content):
    txt = u""
    for line in periods_content:
        txt += \
            trans_VM(u"Policy {}: {} \"In favor\", {} \"Against\", "
                     u"Majority: \"{}\". ").format(
                line.get("VM_period"),
                get_pluriel(line.get("VM_pour"), trans_VM(u"people")),
                get_pluriel(line.get("VM_contre"), trans_VM(u"people")),
                get_vote(line.get("VM_majority")))

        txt += u" <strong>" + trans_VM(u"The policy") + u" " + u"{}".format(
            trans_VM(u"is applied") if \
            line.get("VM_majority") == pms.IN_FAVOR else
            trans_VM(u"is not applied")) + u".</strong><br />"

    gains = [line.get("VM_periodpayoff") for line in periods_content]
    txt += u"<br />" + trans_VM(u"Your payoff is equal to") + \
           u" {} + {} = {}, ".format(
               pms.DOTATION,
               " + ".join(map(str, gains)),
               get_pluriel(periods_content[-1].get(
                   "VM_cumulativepayoff") + pms.DOTATION, pms.MONNAIE)) + \
           trans_VM(u"which corresponds to") + \
           u" {}.".format(get_pluriel((periods_content[-1].get(
               "VM_cumulativepayoff") + pms.DOTATION) * pms.TAUX_CONVERSION,
                                      u"euro"))
    return txt
Ejemplo n.º 4
0
def get_txt_final(in_euros, in_ecus):
    if in_ecus is not None:
        txt = u"Vous avez gagné {}, soit {}.".format(
            get_pluriel(in_ecus, u"ecu"), get_pluriel(in_euros, u"euro"))
    else:
        txt = u"Vous avez gagné {}.".format(get_pluriel(in_euros, u"euro"))
    return txt
Ejemplo n.º 5
0
def get_payoff_text(pay_euros, pay_ecus=None):
    if pay_ecus is not None:
        txt = le2mtrans(u"You've earned {} which corresponds to {}.").format(
            get_pluriel(pay_ecus, u"ecu"), get_pluriel(pay_euros, u"euro"))
    else:
        txt = le2mtrans(u"You've earned {}.".format(
            get_pluriel(pay_euros, u"euro")))
    return txt
def get_payoff_text(pay_euros, pay_ecus=None):
    if pay_ecus is not None:
        txt = trans_TC(u"You've earned {} which corresponds to {}.").format(
            get_pluriel(pay_ecus, pms.MONNAIE), get_pluriel(pay_euros, u"euro"))
    else:
        txt = trans_TC(u"You've earned {}.".format(
            get_pluriel(pay_euros, u"euro")))
    return txt
Ejemplo n.º 7
0
def get_texte_final(gain_ecus, gain_euros, tirage_part_pestuse_gain, tirage_periode_pestuse_gain):
    txt = u"C'est la partie {tir_part_pestuse_gain} et la période {tir_periode_pestuse_gain} qui ont été tirées au sort. Vous avez gagné {gain_en_ecu}, soit {gain_en_euro}.".format(
        tir_part_pestuse_gain = tirage_part_pestuse_gain, 
        tir_periode_pestuse_gain = tirage_periode_pestuse_gain, 
        gain_en_ecu=get_pluriel(gain_ecus, u"ecu"),
        gain_en_euro=get_pluriel(gain_euros, u"euro")
    )
    return txt
Ejemplo n.º 8
0
def get_text_summary(period_content):
    txt = trans_GP(u"You invested {} in the risky option.").format(
        get_pluriel(period_content.get("GP_decision"), pms.MONNAIE))
    txt += u" " + trans_GP(u"The random draw was {}.").format(
        trans_GP(u"Head") if period_content.get("GP_randomdraw") == PILE else \
            trans_GP(u"Tail"))
    txt += u" " + trans_GP(u"Your payoff is equal to {}.").format(
        get_pluriel(period_content.get("GP_periodpayoff"), pms.MONNAIE))
    return txt
def get_text_summary(period_content):
    txt = trans_TC(u"You've found {}.<br />Your group have found a total of "
              u"{}.<br />Each group member earns {}.").format(
        get_pluriel(period_content.get("TC_goodanswers"),
                    trans_TC(u"good answer")),
        get_pluriel(period_content.get("TC_goodanswers_group"),
                    trans_TC(u"good answer")),
        get_pluriel(period_content.get("TC_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 10
0
def get_text_summary(period_content):
    txt = trans_PGG(u"You put {} in your individual account and {} in the "
                    u"public account. Your group put {} in the public "
                    u"account.\nYour payoff for the current period is equal "
                    u"to {}.").format(
        get_pluriel(period_content.get("PGG_indiv"), trans_PGG(u"token")),
        get_pluriel(period_content.get("PGG_public"), trans_PGG(u"token")),
        get_pluriel(period_content.get("PGG_publicgroup"), trans_PGG(u"token")),
        get_pluriel(period_content.get("PGG_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 11
0
def get_recapitulatif(period_content):
    texte = trans_CPR(
        u"You extracted {} and you group extracted a total of {}.\n "
        u"Your payoff is equal to {}").format(
            get_pluriel(period_content.get("CPR_decision"),
                        trans_CPR(u"token")),
            get_pluriel(period_content.get("CPR_decisiongroup"),
                        trans_CPR(u"token")),
            get_pluriel(period_content.get("CPR_periodpayoff"), u"ecu"))
    return texte
Ejemplo n.º 12
0
def get_text_explanation(period, profile):
    txt = trans_VM(u"Policy") + u" {}".format(period)
    txt += u"<br />" + \
           trans_VM(u"If the policy applies it will cost you {} "
                    u"and will provide you a payoff of {}.").format(
            get_pluriel(pms.COUTS[period-1], pms.MONNAIE),
            get_pluriel(profile[period-1], pms.MONNAIE))
    txt += u"<br />" + \
           trans_VM(u"You must vote either in favor of or against the "
                    u"policy.")
    return txt
Ejemplo n.º 13
0
def get_expl_desapprobation(collectif, collectif_groupe):
        individuel = pms.DOTATION - collectif
        txt = u"Vous avez placé {} sur votre compte individuel et {} sur " \
              u"le compte collectif. Au total votre groupe a placé {} sur " \
              u"le compte collectif.\n" \
              u"Vous avez ci-dessous le nombre de jetons placés sur le compte " \
              u"collectif par chacun des autres membres de votre groupe.\n" \
              u"Pour chacun d'eux vous pouvez attribuer entre 0 et {} points " \
              u"de désapprobation".format(
            get_pluriel(individuel, u"jeton"), get_pluriel(collectif, u"jeton"),
            get_pluriel(collectif_groupe, u"jeton"), pms.DESAPPROBATION_MAX)
        return txt
Ejemplo n.º 14
0
def get_text_summary(period_content):
    txt = trans_PGG(u"You put {} in your individual account and {} in the "
                    u"public account. Your group put {} in the public "
                    u"account.\nYour payoff for the current period is equal "
                    u"to {}.").format(
                        get_pluriel(period_content.get("PGG_indiv"),
                                    trans_PGG(u"token")),
                        get_pluriel(period_content.get("PGG_public"),
                                    trans_PGG(u"token")),
                        get_pluriel(period_content.get("PGG_publicgroup"),
                                    trans_PGG(u"token")),
                        get_pluriel(period_content.get("PGG_periodpayoff"),
                                    pms.MONNAIE))
    return txt
Ejemplo n.º 15
0
def get_text_summary(period_content):
    txt = trans_DP(u"You chose {} and the other player chose {}.").format(
        pms.get_option(period_content.get("DP_decision")),
        pms.get_option(period_content.get("DP_decisionother")))
    txt += u" " + trans_DP(u"Your payoff is {}.").format(
        get_pluriel(period_content.get("DP_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 16
0
def get_text_payoff(payoff_infos):
    txt = u""
    for k, v in sorted(payoff_infos.viewitems()):
        txt += u"A la partie {} c'est la période {} qui a été tirée au sort " \
              u"pour la rémunération. Vous avez gagné {}.\n".format(
            k, v["period"], get_pluriel(v["gain_euros"], u"euro"))
    return txt
Ejemplo n.º 17
0
def get_text_summary(period_content):
    txt = trans_DP(u"You chose {} and the other player chose {}.").format(
        pms.get_option(period_content.get("DP_decision")),
        pms.get_option(period_content.get("DP_decisionother")))
    txt += u" " + trans_DP(u"Your payoff is {}.").format(
        get_pluriel(period_content.get("DP_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 18
0
def get_text_explanation(role, value_or_cost):
    if role == pms.ACHETEUR:
        txt = u"Vous êtes acheteur. L'unité de bien vaut pour vous {}.".format(
            get_pluriel(value_or_cost, pms.MONNAIE))
    else:
        txt = u"Vous êtes vendeur. L'unité de bien vous coûte {}.".format(
            get_pluriel(value_or_cost, pms.MONNAIE))

        if pms.TREATMENT == pms.TAXE_UNITE:
            txt += u" Vous devez payer une taxe de {} pour la vente de votre " \
                   u"unité.".format(get_pluriel(pms.TAXE_UNITE_MONTANT, pms.MONNAIE))

        elif pms.TREATMENT == pms.TAXE_VALEUR:
            txt += u" Vous devez payer une taxe de {:.0f}% sur le prix de vente " \
                   u"de votre unité.".format(pms.TAXE_VALEUR_MONTANT * 100)
    return txt
Ejemplo n.º 19
0
def get_recapitulatif(currentperiod):
    """
    return the text of the summary
    :param currentperiod: a dict
    :return: str
    """
    txt = trans_DIC(u"You were player {}.").format(
        u"A" if currentperiod.get("DIC_role") == pms.PLAYER_A else u"B")
    if currentperiod.get("DIC_role") == pms.PLAYER_A:
        txt += trans_DIC(u" You sent {} to player B.").format(
            get_pluriel(currentperiod.get("DIC_decision"), pms.MONNAIE))
    else:
        txt += trans_DIC(u" Player A sent {} to you.").format(
            get_pluriel(currentperiod.get("DIC_recu"), pms.MONNAIE))
    txt += trans_DIC(u" Your payoff is equal to {}.").format(
        get_pluriel(currentperiod.get("DIC_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 20
0
def get_recapitulatif(currentperiod):
    """
    return the text of the summary
    :param currentperiod: a dict
    :return: str
    """
    txt = trans_DIC(u"You were player {}.").format(
        u"A" if currentperiod.get("DIC_role") == pms.PLAYER_A else u"B")
    if currentperiod.get("DIC_role") == pms.PLAYER_A:
        txt += trans_DIC(u" You sent {} to player B.").format(
            get_pluriel(currentperiod.get("DIC_decision"), pms.MONNAIE))
    else:
        txt += trans_DIC(u" Player A sent {} to you.").format(
            get_pluriel(currentperiod.get("DIC_recu"), pms.MONNAIE))
    txt += trans_DIC(u" Your payoff is equal to {}.").format(
        get_pluriel(currentperiod.get("DIC_periodpayoff"), pms.MONNAIE))
    return txt
Ejemplo n.º 21
0
def get_txt_summary(period_content):
    txt = u"<p>Vous disposiez d'une dotation de {}. Vous avez placé {} sur " \
          u"votre compte individuel et {} sur le compte collectif. Au total \
votre groupe a placé {} sur le compte collectif.". \
        format(pms.DOTATION, get_pluriel(period_content.get("BPK_individuel"),
                                         u"jeton"),
               get_pluriel(period_content.get("BPK_collectif"), u"jeton"),
               get_pluriel(period_content.get("BPK_collectif_groupe"),
                           u"jeton"))

    if period_content.get("BPK_desapprobation_recu") is not None:
        txt += u"<br /><b>Vous avez reçu {} de désapprobation.</b>".format(
            get_pluriel(period_content.get("BPK_desapprobation_recu"),
                        u"point"))

    txt += u"<br />Votre gain pour la période est égal à la somme de votre " \
           u"gain issu de votre compte individuel, {}, et de votre gain issu " \
           u"du compte collectif, {}, soit {}.</p>".format(
                get_pluriel(period_content.get("BPK_gain_individuel"),
                            pms.MONNAIE),
                get_pluriel(period_content.get("BPK_gain_collectif"),
                            pms.MONNAIE),
                get_pluriel(period_content.get("BPK_periodpayoff"),
                            pms.MONNAIE))

    return txt
 def _load_grilles(self):
     fichier = str(QtGui.QFileDialog.getOpenFileName(
         self, u"Choisir le fichier de grilles", "",
         u"Fichier pickle (*.pck)"))
     with open(fichier, "rb") as f:
         self._grilles = pickle.load(f)
         self.ui.label_grilles_nb.setText(
             get_pluriel(len(self._grilles), u"grille"))
     logger.info(u"Grilles loaded")
Ejemplo n.º 23
0
 def display_questcomp(self, questions):
     """
     On envoie les questions du questionnaire au fur et à mesure
     """
     questions_fautes = []
     for i, ques in enumerate(questions):
         logger.debug(ques)
         faute = yield (self.remote.callRemote('display_questcomp', ques))
         if faute:
             questions_fautes.append(i + 1)
     self.fautesComprehension = len(questions_fautes)
     self.joueur.info('{} - {}'.format(
         get_pluriel(self.fautesComprehension, le2mtrans(u"fault")),
         questions_fautes))
     txt = le2mtrans(u"You've done {faults}").format(
         faults=get_pluriel(self.fautesComprehension, le2mtrans(u"fault")))
     yield (self.remote.callRemote('display_information', txt))
     self.joueur.remove_waitmode()
def get_text_explanation_grilles():
    text = trans_PGGS(
        u"If you want to, you can contribute to the collective "
        u"account shared by the other group, by realizing the "
        u"tasks below. The task consists in counting the number "
        u"of 1 in the grid. For aach grid for which you find the "
        u"right number of 1 you put {} in the shared collective "
        u"account.").format(
            get_pluriel(pms.EFFORT_UNIT_VALUE, trans_PGGS(u"token")))
    return text
Ejemplo n.º 25
0
 def display_questcomp(self, questions):
     """
     On envoie les questions du questionnaire au fur et à mesure
     """
     questions_fautes = []
     for i, ques in enumerate(questions):
         logger.debug(ques)
         faute = yield(self.remote.callRemote(
             'display_questcomp', ques))
         if faute:
             questions_fautes.append(i+1)
     self.fautesComprehension = len(questions_fautes)
     self.joueur.info('{} - {}'.format(
         get_pluriel(self.fautesComprehension, le2mtrans(u"fault")),
         questions_fautes))
     txt = le2mtrans(u"You've done {faults}").format(
         faults=get_pluriel(self.fautesComprehension, le2mtrans(u"fault")))
     yield(self.remote.callRemote('display_information', txt))
     self.joueur.remove_waitmode()
def get_payoff_text(payoff_euros, payoffs_selected_periods):
    txt = trans_MRI(u"At the periods randomly selected to be paid") + \
          u" ({}) ".format(
              u", ".join(map(str, list(payoffs_selected_periods.viewkeys())))) + \
          trans_MRI(u"you have earned respectively") + u" {}.".format(
          u", ".join(map(str, list(payoffs_selected_periods.viewvalues()))))
    txt += u"<br />" + trans_MRI(u"Your payoff for this experiment is "
                                 u"therefore equal to") + u" {}.".format(
                                     get_pluriel(payoff_euros, pms.MONNAIE))
    return txt
def get_text_explanation(triangle_income, star_income):
    # txt = trans_MRI(u"There are two possible states: Triangle and Star. "
    #                 u"If you don't make any transaction, your income in the "
    #                 u"Triangle state will be {} and your income the Star state "
    #                 u"will be {}. Before to know which one will occur you can "
    #                 u"make transactions with the members of your group. "
    #                 u"A transaction implies that the seller will transfer {} "
    #                 u"to the buyer in case the corresponding state occurs. In "
    #                 u"order to make a transaction a seller and a buyer "
    #                 u"have to agree on a price. To this end, each "
    #                 u"group member can make purchase offers and sell offers for "
    #                 u"each possible state. Two offers (a "
    #                 u"purchase offer and a sell offer) with the same price "
    #                 u"makes a transaction.").format(
    #     get_pluriel(triangle_income, pms.MONNAIE),
    #     get_pluriel(star_income, pms.MONNAIE),
    #     get_pluriel(pms.TRIANGLE_PAY, pms.MONNAIE))
    txt = trans_MRI(
        u"If you don't make any transaction your income in the "
        u"Triangle state will be {} and your income the Star state "
        u"will be {}.").format(get_pluriel(triangle_income, pms.MONNAIE),
                               get_pluriel(star_income, pms.MONNAIE))
    return txt
def get_text_summary(period_content):
    txt = trans_PGGS(u"You put") + \
          u" {} ".format(get_pluriel(period_content.get("PGGS_indivaccount"),
                                     trans_PGGS(u"token"))) + \
        trans_PGGS(u"in your individual account and") + \
        u" {} ".format(get_pluriel(period_content.get("PGGS_groupaccount"),
                                   trans_PGGS(u"token"))) + \
        trans_PGGS(u"in the group account.") + u"<br />" + \
        trans_PGGS(u"Your group put a total of") + \
        u" {} ".format(get_pluriel(period_content.get("PGGS_groupaccountsum"),
                                   trans_PGGS(u"token"))) + \
        trans_PGGS(u"in the group account.")

    if period_content.get("PGGS_treatment") == pms.get_treatment("sol_auto") \
            or (period_content.get("PGGS_treatment") == pms.get_treatment("sol_vote")
                and period_content.get("PGGS_votemajority") == pms.IN_FAVOR):
        txt += u"<br />"
        if period_content.get("PGGS_sinistred"):
            txt += trans_PGGS(u"The other group put") + u" {} ".format(
                get_pluriel(period_content.get("PGGS_groupaccountshared"),
                            trans_PGGS(u"token"))) + \
                   trans_PGGS(u"in its group account, shared with your group.")
            txt += u"<br />" + \
                   trans_PGGS(u"Your payoff for the period is equal to") + \
                u" {} + {} + {} = {}.".format(
                    period_content.get("PGGS_indivaccountpayoff"),
                    period_content.get("PGGS_groupaccountpayoff"),
                    period_content.get("PGGS_groupaccountsharedpayoff"),
                    get_pluriel(period_content.get("PGGS_periodpayoff"),
                                pms.MONNAIE))
        else:
            txt += trans_PGGS(u"Each member of the sinistred groups has a "
                             u"payoff for the period equal to") + \
                  u" {}.".format(
                      get_pluriel(period_content.get("PGGS_groupaccountpayoff"),
                                  pms.MONNAIE))
            txt += u"<br />" + \
                   trans_PGGS(u"Your payoff for the period is equal to") + \
                u" {} + {} = {}.".format(
                    period_content.get("PGGS_indivaccountpayoff"),
                    period_content.get("PGGS_groupaccountpayoff"),
                    get_pluriel(period_content.get("PGGS_periodpayoff"),
                                pms.MONNAIE))
    return txt
def get_text_summary(period_content):
    txt = trans_PGLG(u"You put {} in your individual account, {} in the local "
                     u"account and {} in the global account. "
                     u"Your subgroup put {} in the local account and {} in "
                     u"the global account.\n"
                     u"Your group put {} in the global account.\n"
                     u"Your payoff for the current period is equal "
                     u"to {}.").format(
                         get_pluriel(period_content.get("PGLG_indiv"),
                                     trans_PGLG(u"token")),
                         get_pluriel(period_content.get("PGLG_local"),
                                     trans_PGLG(u"token")),
                         get_pluriel(period_content.get("PGLG_global"),
                                     trans_PGLG(u"token")),
                         get_pluriel(period_content.get("PGLG_localsousgroup"),
                                     trans_PGLG(u"token")),
                         get_pluriel(
                             period_content.get("PGLG_globalsousgroup"),
                             trans_PGLG(u"token")),
                         get_pluriel(period_content.get("PGLG_globalgroup"),
                                     trans_PGLG(u"token")),
                         get_pluriel(period_content.get("PGLG_periodpayoff"),
                                     pms.MONNAIE))
    return txt
Ejemplo n.º 30
0
def get_text_explanation():
    txt = trans_GP(u"You have an endowment of {}. You can invest amount you want in the "
        u"risky option").format(get_pluriel(pms.DOTATION, pms.MONNAIE))
    return txt
def get_text_reponses(nbanswers):
    txt = trans_TC(u"Among your {}, how much do you think are rights?").format(
        get_pluriel(nbanswers, trans_TC(u"answer")))
    return txt
def get_text_summary(period_content):

    sinistred = period_content.get("PGGS_sinistred")
    vote = period_content.get("PGGS_votemajority")
    get_token = lambda x: get_pluriel(x, trans_PGGS(u"token"))
    sentences = list()

    sentences.append(
        trans_PGGS(u"you put {} in your individual account and {} in the "
                   u"collective account. Your group put a total of "
                   u"{} in the collective account.").format(
                       get_token(period_content["PGGS_indivaccount"]),
                       get_token(period_content["PGGS_groupaccount"]),
                       get_token(period_content["PGGS_groupaccountsum"])))
    sentences.append(
        trans_PGGS(
            u"Your payoff for the period is equal to {} + {} = {}.").format(
                period_content["PGGS_indivaccountpayoff"],
                period_content["PGGS_groupaccountpayoff"],
                get_pluriel(period_content["PGGS_periodpayoff"], pms.MONNAIE)))

    if pms.TREATMENT == pms.SOL_AUTO or \
    (pms.TREATMENT == pms.SOL_VOTE and vote == pms.IN_FAVOR):
        sentences.pop(1)
        if sinistred:
            sentences.append(
                trans_PGGS(
                    u"The other group put {} in its collective "
                    u"account, shared with your group. Your "
                    u"payoff for the period is equal to "
                    u"{} + {} + {} = {}").format(
                        get_token(
                            period_content["PGGS_groupaccountsharedsum"]),
                        period_content["PGGS_indivaccountpayoff"],
                        period_content["PGGS_groupaccountpayoff"],
                        period_content["PGGS_groupaccountsharedpayoff"],
                        get_pluriel(period_content["PGGS_periodpayoff"],
                                    pms.MONNAIE)))
        else:
            sentences.append(
                trans_PGGS(
                    u"Each member of the sinistred group has a "
                    u"payoff for the period equal to {}. Your "
                    u"payoff for the period is equal to "
                    u"{} + {} = {}.").format(
                        get_pluriel(
                            period_content.get("PGGS_groupaccountpayoff"),
                            pms.MONNAIE),
                        period_content["PGGS_indivaccountpayoff"],
                        period_content["PGGS_groupaccountpayoff"],
                        get_pluriel(period_content["PGGS_periodpayoff"],
                                    pms.MONNAIE)))

    if pms.TREATMENT == pms.SOL_AUTO_CONDITIONAL or \
    (pms.TREATMENT == pms.SOL_VOTE_CONDITIONAL and vote == pms.IN_FAVOR):
        sentences.pop(1)
        if sinistred:
            sentences.append(
                trans_PGGS(u"You have found {} and therefore have put {} in "
                           u"the collective account shared by the other "
                           u"group. Your group put a total of {} in this "
                           u"account and the other group {}. "
                           u"There are a total of {} in this account. Your "
                           u"payoff for the period is equal to "
                           u"{} + {} + {} = {}.").
                format(
                    get_pluriel(period_content["PGGS_grids"],
                                trans_PGGS(u"grid")),
                    get_token(period_content["PGGS_groupaccountshared"]),
                    get_token(
                        period_content["PGGS_groupaccountsharedsinistredsum"]),
                    get_token(
                        period_content["PGGS_groupaccountsharedsum"] -
                        period_content["PGGS_groupaccountsharedsinistredsum"]),
                    get_token(period_content["PGGS_groupaccountsharedsum"]),
                    period_content["PGGS_indivaccountpayoff"],
                    period_content["PGGS_groupaccountpayoff"],
                    period_content["PGGS_groupaccountsharedpayoff"],
                    get_pluriel(period_content["PGGS_periodpayoff"],
                                pms.MONNAIE)))
        else:
            sentences.append(
                trans_PGGS(u"The other group put {} in the collective "
                           u"account you share you him. There are "
                           u"therefore a total of {} in this account. Each "
                           u"member of the sinistred group has a "
                           u"payoff for the period equal to {}. Your "
                           u"payoff for the period is equal to "
                           u"{} + {} = {}.").
                format(
                    get_token(period_content["PGGS_groupaccountsharedsum"] -
                              period_content["PGGS_groupaccountsum"]),
                    get_token(period_content["PGGS_groupaccountsharedsum"]),
                    period_content["PGGS_groupaccountsharedpayoff"],
                    period_content["PGGS_indivaccountpayoff"],
                    period_content["PGGS_groupaccountsharedpayoff"],
                    get_pluriel(period_content["PGGS_periodpayoff"],
                                pms.MONNAIE)))

    return u"<br />".join(sentences)
def get_text_summary(period_content):
    logger.debug(period_content)
    txt = trans_MRI(
        u"On the triangle market, you've made {} ({}) and {} ({}).").format(
            get_pluriel(period_content["MRI_triangle_number_of_purchase"],
                        trans_MRI(u"purchase")),
            get_pluriel(period_content["MRI_triangle_sum_of_purchase"],
                        pms.MONNAIE),
            get_pluriel(period_content["MRI_triangle_number_of_sell"],
                        trans_MRI(u"sell")),
            get_pluriel(period_content["MRI_triangle_sum_of_sell"],
                        pms.MONNAIE))
    txt += u" "
    txt += trans_MRI(
        u"On the star market, you've made {} ({}) and {} ({}).").format(
            get_pluriel(period_content["MRI_star_number_of_purchase"],
                        trans_MRI(u"purchase")),
            get_pluriel(period_content["MRI_star_sum_of_purchase"],
                        pms.MONNAIE),
            get_pluriel(period_content["MRI_star_number_of_sell"],
                        trans_MRI(u"sell")),
            get_pluriel(period_content["MRI_star_sum_of_sell"], pms.MONNAIE))
    txt += u"<br />"
    txt += trans_MRI(u"It's the {} state that has been drawn.").format(
        trans_MRI(u"Triangle") if period_content["MRI_event"] ==
        pms.TRIANGLE else trans_MRI(u"Star"))
    txt += u" "
    sells = period_content["MRI_triangle_number_of_sell"] if \
        period_content["MRI_event"] == pms.TRIANGLE else \
        period_content["MRI_star_number_of_sell"]
    purchases = period_content["MRI_triangle_number_of_purchase"] if \
        period_content["MRI_event"] == pms.TRIANGLE else \
        period_content["MRI_star_number_of_purchase"]
    txt += trans_MRI(
        u"You therefore have transferred {} and received {}.").format(
            get_pluriel(sells, pms.MONNAIE),
            get_pluriel(purchases, pms.MONNAIE))
    txt += u"<br />"

    # detail period payoff
    sum_purchases = period_content["MRI_triangle_sum_of_purchase"] + \
                    period_content["MRI_star_sum_of_purchase"]
    sum_sells = period_content["MRI_triangle_sum_of_sell"] + \
                period_content["MRI_star_sum_of_sell"]
    txt_detail_payoff = trans_MRI(
        u"{} + {} (sells) - {} (purchases) + "
        u"{} (received) - {} (transferred)").format(
            period_content["MRI_endowment_triangle"]
            if period_content["MRI_event"] == pms.TRIANGLE else
            period_content["MRI_endowment_star"], sum_sells, sum_purchases,
            purchases, sells)

    txt += trans_MRI(
        u"Your payoff for this period is equal to {} ({}).").format(
            get_pluriel(period_content["MRI_periodpayoff"], pms.MONNAIE),
            txt_detail_payoff)
    logger.debug(txt)
    return txt

TITLE_MSG = namedtuple("TITLE_MSG", "titre message")

# MULTI-ECRANS =================================================================
PERIODE_label = lambda periode: trans_CPR(u"Period {}").format(periode)

# ECRAN DECISION ===============================================================
DECISION_explication = \
    trans_CPR(u"You have two accounts: a private account and a public account. "
         u"The public account has {}. Each group member can extract a maximum "
         u"of {} from the public account to put on his/her private account. "
         u"The payoff of each member depends on the number of tokens he/she "
         u"has put on his/her private account as well as on the total number "
         u"of tokens extracted by the group from the public account.").format(
        get_pluriel(pms.DECISION_MAX * pms.TAILLE_GROUPES, trans_CPR(u"token")),
        get_pluriel(pms.DECISION_MAX, trans_CPR(u"token")))

DECISION_label = trans_CPR(u"Please choose how much you want to extract from the "
                      u"public account")

DECISION_titre = trans_CPR(u"Decision")

DECISION_confirmation = TITLE_MSG(
    trans_CPR(u"Confirmation"), trans_CPR(u"Do you confirm your choice?"))


def get_histo_head():
    return [le2mtrans(u"Period"), le2mtrans(u"Decision"),
             le2mtrans(u"Period\npayoff"), le2mtrans(u"Cumulative\npayoff")]
Ejemplo n.º 35
0
        hb["DIC_periodpayoff"] = trans_DIC(u"Payoff")
        histo_build[role] = hb
    return histo_build[role]


# ROLE =========================================================================
def get_role(role):
    return trans_DIC(u"You are player {}").format(
        u"A" if role == pms.PLAYER_A else u"B")


# DECISION =====================================================================
DECISION_titre = trans_DIC(u"Decision")
DECISION_explication = trans_DIC(u"You have an endowment of {}. You can send any "
                            u"amount you want to player B").format(
    get_pluriel(pms.DOTATION, pms.MONNAIE))
DECISION_label = trans_DIC(u"Choose the amount you want to send to player B")
DECISION_confirmation = TITLE_MSG(
    trans_DIC(u"Confirmation"),
    trans_DIC(u"Do you confirm you choice?"))


# SUMMARY ======================================================================
def get_recapitulatif(currentperiod):
    """
    return the text of the summary
    :param currentperiod: a dict
    :return: str
    """
    txt = trans_DIC(u"You were player {}.").format(
        u"A" if currentperiod.get("DIC_role") == pms.PLAYER_A else u"B")
Ejemplo n.º 36
0
def get_final_text(final_payoff):
    txt = le2mtrans(u"Your payoff for the experiment is equal to ") + \
        u" {}".format(get_pluriel(final_payoff, params.getp("CURRENCY")))
    return txt
Ejemplo n.º 37
0
                                languages=[params.getp("LANG")]).ugettext

TITLE_MSG = namedtuple("TITLE_MSG", "titre message")

# MULTI-ECRANS =================================================================
PERIODE_label = lambda periode: trans_CPR(u"Period {}").format(periode)

# ECRAN DECISION ===============================================================
DECISION_explication = \
    trans_CPR(u"You have two accounts: a private account and a public account. "
         u"The public account has {}. Each group member can extract a maximum "
         u"of {} from the public account to put on his/her private account. "
         u"The payoff of each member depends on the number of tokens he/she "
         u"has put on his/her private account as well as on the total number "
         u"of tokens extracted by the group from the public account.").format(
        get_pluriel(pms.DECISION_MAX * pms.TAILLE_GROUPES, trans_CPR(u"token")),
        get_pluriel(pms.DECISION_MAX, trans_CPR(u"token")))

DECISION_label = trans_CPR(
    u"Please choose how much you want to extract from the "
    u"public account")

DECISION_titre = trans_CPR(u"Decision")

DECISION_confirmation = TITLE_MSG(trans_CPR(u"Confirmation"),
                                  trans_CPR(u"Do you confirm your choice?"))


def get_histo_head():
    return [
        le2mtrans(u"Period"),
Ejemplo n.º 38
0
        histo_build[role] = hb
    return histo_build[role]


# ROLE =========================================================================
def get_role(role):
    return trans_DIC(u"You are player {}").format(u"A" if role ==
                                                  pms.PLAYER_A else u"B")


# DECISION =====================================================================
DECISION_titre = trans_DIC(u"Decision")
DECISION_explication = trans_DIC(
    u"You have an endowment of {}. You can send any "
    u"amount you want to player B").format(
        get_pluriel(pms.DOTATION, pms.MONNAIE))
DECISION_label = trans_DIC(u"Choose the amount you want to send to player B")
DECISION_confirmation = TITLE_MSG(trans_DIC(u"Confirmation"),
                                  trans_DIC(u"Do you confirm you choice?"))


# SUMMARY ======================================================================
def get_recapitulatif(currentperiod):
    """
    return the text of the summary
    :param currentperiod: a dict
    :return: str
    """
    txt = trans_DIC(u"You were player {}.").format(
        u"A" if currentperiod.get("DIC_role") == pms.PLAYER_A else u"B")
    if currentperiod.get("DIC_role") == pms.PLAYER_A:
Ejemplo n.º 39
0
def get_final_text(final_payoff):
    txt = le2mtrans(u"Your payoff for the experiment is equal to ") + \
        u" {}".format(get_pluriel(final_payoff, params.getp("CURRENCY")))
    return txt
Ejemplo n.º 40
0
def get_texte_final(gain_ecus, gain_euros):
    txt = u"Vous avez gagné {gain_en_ecu}, soit {gain_en_euro}.".format(
        gain_en_ecu=get_pluriel(gain_ecus, u"ecu"),
        gain_en_euro=get_pluriel(gain_euros, u"euro"))
    return txt