For the complete documentation index, see llms.txt. This page is also available as Markdown.

Manage locales and the fallback language

curl https://mburger.cloud/api/blocks/<id>/sections?locale=en&force_locale_fallback=true
-H "Accept: application/json" 
-H "X-MBurger-Token: <token>" 
-H "X-MBurger-Version: 3"
// Set MBurger Locale
MBManager.shared.locale = Locale(identifier: "en_EN")
        
// Ask a section with the force locale fallback parameter
MBClient.getSection(withId: SECTION_ID,
                    parameters: [MBForceLocaleFallbackParameter()],
                    success: { section in
                                
                    },
                    failure: { error in
                                
                    })
val arrayParameters = ArrayList<Any>()
arrayParameters.add(MBLocaleParameter(locale = YOUR_LOCALE))
//or if you want to force having fallback locale if sections are not completed
arrayParameters.add(MBForceLocaleFallback())

val sectionsListener = object: MBSectionsResultListener{
            override fun onSectionsApiError(error: String) {
            }

            override fun onSectionsApiResult(sections: ArrayList<MBSection>, 
                                             block_id: Long, 
                                             paginationInfos: MBPaginationInfo) {
            }
        }
        
MBurgerTasks.askForSections(context = applicationContext, 
                         block_id = BLOCK_ID,
                         filters = arrayParameters,
                         getElements = true,
                         listener = sectionsListener)

Last updated