firebase-error-translator
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    firebase-error-translator

    Helps to handle the firebase errors based on their codes, you can translate the error to any of the available languages. (Now only works with auth errors)


    Build Status dependencies Status npm npm GitHub top language GitHub Repo stars

    Use

    import { setLanguage, getTranslation } from 'firebase-error-translator'
    
    setLanguage('es')
    
    (async ()=>{
        try{
            await firebaseOperation()
        }
        catch(err){
            handleError(getTranslation(err.code))
        }
    })()

    Available Languages

    Here is a list of the available languages that you can use and the how to config them. Now there are 20 languages

    • Arabic
    setLanguage('ar')
    • Bengali
    setLanguage('bn')
    • German
    setLanguage('de')
    • English (default)
    setLanguage('en')
    • Spanish
    setLanguage('es')
    • Persian
    setLanguage('fa')
    • French
    setLanguage('fr')
    • Hebrew
    setLanguage('he')
    • Indonesian
    setLanguage('id')
    • Italian
    setLanguage('it')
    • Japanese
    setLanguage('ja')
    • Korean
    setLanguage('ko')
    • Nepali
    setLanguage('ne')
    • Polish
    setLanguage('pl')
    • Portuguese
    setLanguage('pt')
    • Russian
    setLanguage('ru')
    • Thai
    setLanguage('th')
    • Turkish
    setLanguage('tr')
    • Vietnamese
    setLanguage('vi')
    • Chinese
    setLanguage('zh')

    Translations

    The translations are from the Firebase Documentation. If you want to add an extra language, you can dowload the repo and create a file in src/languages/language code.ts (the language code is based in the ISO 639-1 rules). Then follow this structure:

    const translations = {
        "auth/code": "Full Message.",
        // ...
    
        "else": "Server Error." // Translate this message to the language.  
    }
    
    export default translations

    Install

    npm i firebase-error-translator

    DownloadsWeekly Downloads

    18

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    477 kB

    Total Files

    120

    Last publish

    Collaborators

    • jebbarbas