Sign in to follow this  
Shima_Max

How to set default text in updateAsync?

Recommended Posts

I'm trying to send custom update, but default text field doesn't work. Text replased by standart facebook plug. How can I specify standart text if no localization found?

FBInstant.updateAsync({
	action: 'CUSTOM',
	cta: 'Play',
	image: imgBase64,
	text: {
                default: 'DEFAULT text',
		localizations: {
			en_US: 'US text',
		}
	},
	template: 'INVASION',
	data: {},
	strategy: 'IMMEDIATE',
	notification: 'NO_PUSH',
})
.catch(err => console.error(err));

 

Share this post


Link to post
Share on other sites

@Noel thank you for answer. My task is to display message on English for all users regardless of the location. My solution now is:
 

const locales = ['ak_GH','am_ET','ar_AR','as_IN','ay_BO','az_AZ','be_BY','bg_BG','bn_IN','bp_IN','br_FR','bs_BA','ca_ES','cb_IQ','ck_US','co_FR','cs_CZ','cx_PH','cy_GB','da_DK','de_DE','el_GR','en_GB','en_PI','en_UD','en_US','eo_EO','es_ES','es_LA','es_MX','et_EE','eu_ES','fa_IR','fb_LT','ff_NG','fi_FI','fo_FO','fr_CA','fr_FR','fy_NL','ga_IE','gl_ES','gn_PY','gu_IN','gx_GR','ha_NG','he_IL','hi_IN','hr_HR','ht_HT','hu_HU','hy_AM','id_ID','ig_NG','is_IS','it_IT','ja_JP','ja_KS','jv_ID','ka_GE','kk_KZ','km_KH','kn_IN','ko_KR','ks_IN','ku_TR','ky_KG','la_VA','lg_UG','li_NL','ln_CD','lo_LA','lt_LT','lv_LV','mg_MG','mi_NZ','mk_MK','ml_IN','mn_MN','mr_IN','ms_MY','mt_MT','my_MM','nb_NO','nd_ZW','ne_NP','nl_BE','nl_NL','nn_NO','nr_ZA','ns_ZA','ny_MW','or_IN','pa_IN','pl_PL','ps_AF','pt_BR','pt_PT','qc_GT','qu_PE','qz_MM','rm_CH','ro_RO','ru_RU','rw_RW','sa_IN','sc_IT','se_NO','si_LK','sk_SK','sl_SI','sn_ZW','so_SO','sq_AL','sr_RS','ss_SZ','st_ZA','sv_SE','sw_KE','sy_SY','sz_PL','ta_IN','te_IN','tg_TJ','th_TH','tk_TM','tl_PH','tl_ST','tn_BW','tr_TR','ts_ZA','tt_RU','tz_MA','uk_UA','ur_PK','uz_UZ','ve_ZA','vi_VN','wo_SN','xh_ZA','yi_DE','yo_NG','zh_CN','zh_HK','zh_TW','zu_ZA','zz_TR'];

const text = 'My text';

{
    localizations: locales.reduce((prev, cur) => {

	prev[cur] = text;

	return prev;

    }, {})
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.