Comments (23)
Could you add LANGUAGE_CODE to uiConfig?
from firebaseui-web.
@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.
Any news?¿?
from firebaseui-web.
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.
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.
@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.
Any news on this? or is modifying text after the dom loads still the best thing to do?
from firebaseui-web.
How does this solution play with Angular? I don't think it does...
from firebaseui-web.
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.
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.
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.
Thanks for the feedback! We will take that into consideration.
from firebaseui-web.
@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.
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.
@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.
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.
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.
Guys, could you please opensource the library or enable support of Russian language? Would be great! Thank you.
from firebaseui-web.
Hi @kosenin, FirebaseUI is already open sourced.
from firebaseui-web.
This is fixed in FirebaseUI 2.2.1.
See https://github.com/firebase/firebaseui-web#localized-widget for instructions.
from firebaseui-web.
Thanks so much guys!
from firebaseui-web.
@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.
Is there a solution in 2024 to avoid the need for building code?
from firebaseui-web.
Related Issues (20)
- FirebaseUI doesn't work properly in chrome mobile randomly: 20s latency onAuthStateChanged event HOT 7
- Incorrect error message when password requirements not met HOT 3
- Support Firebase JS SDK v9 and v10 HOT 3
- Typescript error when trying to use an async function for signInSuccessWithAuthResult callback HOT 1
- FirebaseUI compatibility with modular SDK HOT 1
- App Check isn't compatible with firebaseUI email login HOT 6
- Impossible to initialize firebase analytics for web
- Twitter authorisation throws "The supplied auth credential is incorrect, malformed or has expired. (auth/invalid-credential)"
- Will this project continue in 2024? HOT 1
- ANONYMOUS USER PROVIDER IS NOT WORKING IN FIREBASE UI HOT 3
- Working FirebaseUI Package for React and Next.js HOT 5
- Facebook logins stopped working on Android devices HOT 9
- Seems like Microsoft login doesn't work properly anymore HOT 1
- Unable to sign-in as cross-site cookies are blocked HOT 3
- Safari does not work on MacOS. It does not work at all on iOS devices - nor Chrome, nor Safari in redirect mode. HOT 1
- Google Sign-in doesn't work when AppCheck is enabled
- Catch all errors from sign in - improvement for signInFailure HOT 4
- [Firefox] Flash of unstyled content when sending/verifying phone otp HOT 2
- firebaseui doesn't work with sessionStorage when localStorage unavailable HOT 1
- Google one tap login, Worked before, but now get "The selected credential for the authentication provider is not supported!" HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebaseui-web.