How to use the i18n-js.currentLocale function in i18n-js

To help you get started, we’ve selected a few i18n-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catarse / catarse.js / src / root / projects-reward.js View on Github external
controller(args) {
        const vm = rewardVM,
            selectedReward = vm.selectedReward,
            selectReward = vm.selectReward,
            rewards = vm.rewards(),
            mode = projectVM.currentProject().mode,
            faq = I18n.translations[I18n.currentLocale()].projects.faq[mode];

        // TODO unify projectsReward and project-reward-list reward submission. fix routing issue.
        const submitContribution = () => {
            const valueFloat = h.monetaryToFloat(vm.contributionValue);

            if (valueFloat < vm.selectedReward().minimum_value) {
                vm.error(`O valor de apoio para essa recompensa deve ser de no mínimo R$${vm.selectedReward().minimum_value}`);
            } else if (!h.getUser()) {
                h.storeObject(storeKey, { value: valueFloat, reward: vm.selectedReward() });

                return h.navigateToDevise(`/${projectVM.currentProject().permalink}`);
            } else {
                vm.error('');
                vm.contributionValue(valueFloat);
                m.route(`/projects/${projectVM.currentproject().project_id}/payment`, {
                    project_user_id: projectVM.currentProject().user_id
github catarse / catarse.js / src / root / project-edit-reward.js View on Github external
limited: h.toggleProp(limited, !limited),
                    paid_count: m.prop(reward.paid_count),
                    row_order: m.prop(reward.row_order),
                    shipping_options: m.prop(reward.shipping_options),
                    title: m.prop(reward.title),
                    waiting_payment_count: m.prop(reward.waiting_payment_count)
                });
                rewards().push(rewardProp);
            });

            if (rewardVM.rewards().length === 0) {
                rewards().push(m.prop(newReward()));
            }
        });

        const tips = I18n.translations[I18n.currentLocale()].projects.reward_fields.faq;

        loadRewards();

        return {
            loading,
            error,
            errors,
            showSuccess,
            rewards,
            user: userVM.fetchUser(args.user_id),
            newReward,
            setSorting,
            tips
        };
    },
github catarse / catarse.js / src / vms / insight-vm.js View on Github external
content(state, data) {
        const translations = I18n.translations[
            I18n.currentLocale()
        ].projects.successful_onboard[state],
              translationContext = (state === 'finished' ? {
                  link_news: `/projects/${_.first(data.account()).project_id}/posts`
              } : parseAccountData(
                  _.first(data.account()),
                  _.first(data.transfer())
              ));
        let contentObj = {};

        _.map(translations, (translation, translationKey) => {
            contentObj = _.extend({}, contentObj, {
                [translationKey]: I18n.t(`${state}.${translationKey}`, I18nScope(translationContext))
            });
        });
        return contentObj;
    }