Closed thiagoantunes closed 7 years ago
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.
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"
@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?
i need suport for portuguese, by the way, i hope you can use lan atribute for meta tag to get how language user use
Thanks for the feedback! We will take that into consideration.
@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}
@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!
@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 :)
@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);`
@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.
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.
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.
Guys, could you please opensource the library or enable support of Russian language? Would be great! Thank you.
Hi @kosenin, FirebaseUI is already open sourced.
Any news on this? or is modifying text after the dom loads still the best thing to do?
Any news?¿?
This is fixed in FirebaseUI 2.2.1.
See https://github.com/firebase/firebaseui-web#localized-widget for instructions.
Thanks so much guys!
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...
Could you add LANGUAGE_CODE to uiConfig?
@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).
How does this solution play with Angular? I don't think it does...
Is there a solution in 2024 to avoid the need for building code?
Is there any support for other languages?