Giter VIP home page Giter VIP logo

Comments (23)

eduard2014 avatar eduard2014 commented on September 17, 2024 55

Could you add LANGUAGE_CODE to uiConfig?

from firebaseui-web.

BrunoGiubilei avatar BrunoGiubilei commented on September 17, 2024 5

@alfongj i create this code to modify text to portuguese after elements inserted in DOM:

`var clock = setInterval(query, 1000), term = "Sign in with", portugueseTerm = "Entrar com o ", change = false;

var uiConfig = {

    'signInSuccessUrl': 'main.html',
    'signInOptions': [
        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
        firebase.auth.FacebookAuthProvider.PROVIDER_ID,
        firebase.auth.TwitterAuthProvider.PROVIDER_ID,
        firebase.auth.GithubAuthProvider.PROVIDER_ID,
        firebase.auth.EmailAuthProvider.PROVIDER_ID
    ],
    'tosUrl': 'terms.html',
};

if (typeof localStorage["firebaseui::rememberedAccounts"] == "undefined") {

    var ui = new firebaseui.auth.AuthUI(firebase.auth());
    ui.start('#firebaseui-auth-container', uiConfig);
} else {

    window.location.href = "main.html";
}

function query() {

    if (change == true) {

        clearInterval(clock);
    }

    for (i in document.getElementsByTagName('span')) {

        if (typeof document.getElementsByTagName('span')[i].textContent != "undefined") {

            var element = document.getElementsByTagName('span')[i];

            element.textContent = element.textContent.replace(term,portugueseTerm);
            change = true;
        }
    }
}`

it´s not sexy, but works!

from firebaseui-web.

phyr0s avatar phyr0s commented on September 17, 2024 5

Any news?¿?

from firebaseui-web.

cpmech avatar cpmech commented on September 17, 2024 5

Unfortunately, the solution in https://github.com/firebase/firebaseui-web#localized-widget does not allow for dynamically selecting the language. In fact, with more than 3 languages it becomes very tedious...

from firebaseui-web.

BrunoGiubilei avatar BrunoGiubilei commented on September 17, 2024 4

i need suport for portuguese, by the way, i hope you can use lan atribute for meta tag to get how language user use

from firebaseui-web.

gpechim avatar gpechim commented on September 17, 2024 3

@alfongj this solution solve your question and other places that you want translate depending on the browser language, it works too!

In fact this is also a function for the translation of languages regardless of which project it is. Enjoy \o/`

var initTranslate = function() {
    setTimeout(function() {
    dl = 'pt-BR';
    bl = navigator.language;
    google = 'Google';
    facebook = 'Facebook';
    email = 'password';
    bl === 'en-US' || bl === 'en-us' ? runlang(bl) : runlang(dl);

    function translate(text, provider) {
        var container = $('.firebaseui-idp-' + provider.toLowerCase() + ' .firebaseui-idp-text-long');
        if(provider === 'password'){
            provider = 'email';
            container.text(text+' '+provider);
        } else{
            container.text(text+' '+provider);
        }
    }

    function runlang(lang) {
        if (lang === 'en-US' || lang === 'en-us') {
            sign_in = 'Sign in with';
            translate( sign_in, google );
            translate( sign_in, facebook );
            translate( sign_in, email );
        } else {
            sign_in = 'Entrar com';
            translate( sign_in, google );
            translate( sign_in, facebook );
            translate( sign_in, email );
        }
    }
}, 1500); }; window.addEventListener('load', initTranslate);`

from firebaseui-web.

mikaturk avatar mikaturk commented on September 17, 2024 1

Any news on this? or is modifying text after the dom loads still the best thing to do?

from firebaseui-web.

crdev avatar crdev commented on September 17, 2024 1

How does this solution play with Angular? I don't think it does...

from firebaseui-web.

bojeil-google avatar bojeil-google commented on September 17, 2024

Not currently, but that's the long term goal. The code will most likely be open sourced ahead of that and you'll have the ability to modify the templates with your target language.

from firebaseui-web.

BrunoGiubilei avatar BrunoGiubilei commented on September 17, 2024

bojeil-google, i have the same question. Can i change this file ? Or get a pretify model ?

"https: //www.gstatic.com/firebasejs/ui/live/0.5/firebase-ui-auth.js"

from firebaseui-web.

alfongj avatar alfongj commented on September 17, 2024

@BrunoGiubilei

Technically you can modify that file, but I would recommend waiting for us to open source it (we are working on it and hope to be ready soon) and modify the open sourced version. Currently our implementation uses some internal google dependencies that could make it a bit too complicated for you to modify it yourself.

By the way, could you please comment on what is your use case? Is it supporting different locales? If so, could you comment which?

from firebaseui-web.

alfongj avatar alfongj commented on September 17, 2024

Thanks for the feedback! We will take that into consideration.

from firebaseui-web.

jalajc avatar jalajc commented on September 17, 2024

@alfongj would love to see a Hindi language version.
Getting meta tag to know language is the noble way as @BrunoGiubilei suggested.
Would rather prefer a config parameter so that dynamic language interchange is possible with users choice. Interestingly, majority of internet population is multilingual.
So, I think boil-the-ocean logic could be:
if { Firebase lang config parameter present; use that}; elseif {html hreflang present, pick that}; else {default to browser/system lang/eng}

from firebaseui-web.

alfongj avatar alfongj commented on September 17, 2024

@BrunoGiubilei

Thanks for sharing! I am glad you were able to make it work.

We hope to make it easier in the future though, so less work is required on your side :)

from firebaseui-web.

jalajc avatar jalajc commented on September 17, 2024

@gpechim This is great. Though this has valid use cases, thing that concerns me here is we are first having a text which is loaded, and then pulling the the translated text resulting in some extra data exchange and round trips.
But ya in absence of alternative this seems ok.
@ all
I would prefer loading a fairly pre transalated flavor of firebase-ui js , may be specified through some language config parameter. But, I believe, this also has to be taken at firebase.js level as many parameters /error messages originate there.

from firebaseui-web.

drishi94 avatar drishi94 commented on September 17, 2024

Thank you very much @gpechim. We have plans to work on adding language support to FirebaseUI gradually, but for the time being I hope some of the workarounds posted on this thread are helpful.

from firebaseui-web.

MentalGear avatar MentalGear commented on September 17, 2024

Still no international support for login from the Firebase team ... ? Common guys, if you want firebase to be used globally, you should put the effort into it, especially since you're now google & money shouldn't be an issue.

from firebaseui-web.

kosenin avatar kosenin commented on September 17, 2024

Guys, could you please opensource the library or enable support of Russian language? Would be great! Thank you.

from firebaseui-web.

TMSCH avatar TMSCH commented on September 17, 2024

Hi @kosenin, FirebaseUI is already open sourced.

from firebaseui-web.

channing-google avatar channing-google commented on September 17, 2024

This is fixed in FirebaseUI 2.2.1.

See https://github.com/firebase/firebaseui-web#localized-widget for instructions.

from firebaseui-web.

mikaturk avatar mikaturk commented on September 17, 2024

Thanks so much guys!

from firebaseui-web.

landsman avatar landsman commented on September 17, 2024

@channing-google this should be re-open. It's more hack than a proper solution. Building whole thing because localization is overkill (200kb each language).

from firebaseui-web.

molavec avatar molavec commented on September 17, 2024

Is there a solution in 2024 to avoid the need for building code?

from firebaseui-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.