help_me_with_php Posted January 20, 2013 Share Posted January 20, 2013 all, I'm doing a little pre-emptive work here on a PHP webapp and I'm wondering what people think about the differences between the built-in resources between PHP and the .NET framework when it comes to offering an application in different languages. Is this very simple? I did see a reference on the web to the global HTTP_ACCEPT_LANGUAGE. I realize that primary languages are to be declared in headers based on their ISO codes but has anyone ever offered, in a webapp, a control somewhere on a page for language translation? I know that Microsoft built this in to their software a long time ago and I think it is prevelent and can be used in .NET but I don't use Microsoft technology unless I absolutely have to. Is this kind of a concern even relevant anymore or is this functionality now built into web browsers either by default or by add-ons or extensions? thanks guys. any insight would be great. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/ Share on other sites More sharing options...
kicken Posted January 20, 2013 Share Posted January 20, 2013 For the most part users can use something like google translate to translate a page. There might still be reasons to offer your own translations though such as if google does not provide a good enough translation by your standards of your content. What it boils down to basically is determining what language the user wants, and then pulling the appropriate version of the requested content. To determine what language a user wants you can check for the presence of the Accept-Language: http header ($_SERVER['HTTP_ACCEPT_LANGUAGE']) and parse it's value for a best match. You can also let the user specify a language using a dropdown/link somewhere on the page. Once you know the language they want you just have to query your content for that language, and also provide your general templates in the appropriate language. On the template side of things you can either have separate template files and choose one to use conditionally, or use something like the gettext extension to pull the proper translation of various strings from a database of translations. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407135 Share on other sites More sharing options...
help_me_with_php Posted January 20, 2013 Author Share Posted January 20, 2013 For the most part users can use something like google translate to translate a page. There might still be reasons to offer your own translations though such as if google does not provide a good enough translation by your standards of your content. What it boils down to basically is determining what language the user wants, and then pulling the appropriate version of the requested content. To determine what language a user wants you can check for the presence of the Accept-Language: http header ($_SERVER['HTTP_ACCEPT_LANGUAGE']) and parse it's value for a best match. You can also let the user specify a language using a dropdown/link somewhere on the page. Once you know the language they want you just have to query your content for that language, and also provide your general templates in the appropriate language. On the template side of things you can either have separate template files and choose one to use conditionally, or use something like the gettext extension to pull the proper translation of various strings from a database of translations. That's incredibly useful, Kicken. Nice. Thanks so much. A couple of follow-ups for you if you don't mind: 1) Can template files be found on the web, and if so can you point me to a reputable place that offers the best translations?? 2) Are the use of these files a separate process in a web application or are they part of a site databases somehow and reference via simply querying (hopefully you haven't already answered that). 3) Per your signature, where exactly is "14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7"? I don't have a program to decode that at into a URL at the moment. =) Come to think of it, I have yet to do the research on the encryption (or whatever it is that's used) that outputs in URLs such that all alphas and numerics can be used for identification of the site item. I've seen plenty of sites do this (youtube, I believe?). I thought you'd enjoy this question, no need to humor me with an answer. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407141 Share on other sites More sharing options...
Jessica Posted January 20, 2013 Share Posted January 20, 2013 It's not a url, it's his bitcoin address. Something that could be determined in a few seconds by using google. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407145 Share on other sites More sharing options...
help_me_with_php Posted January 20, 2013 Author Share Posted January 20, 2013 It's not a url, it's his bitcoin address. Something that could be determined in a few seconds by using google. ah ha...and the smarty pants college grad shows me up again...it was a joke. but thanks for the help girly! nice seeing ya again... Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407147 Share on other sites More sharing options...
help_me_with_php Posted January 20, 2013 Author Share Posted January 20, 2013 satisfaction for Jessica only: https://en.bitcoin.it/wiki/Address Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407149 Share on other sites More sharing options...
Jessica Posted January 20, 2013 Share Posted January 20, 2013 ah ha...and the smarty pants college grad shows me up again...it was a joke. but thanks for the help girly! nice seeing ya again... If you're going to try to insult me, you might try to get your facts straight. I'm a twice-dropout. For the future, you might think about your "jokes". A joke in which you pretend to not understand something, then when someone tells you what it is you respond by saying you knew and it was a joke - doesn't make much sense as a joke. I *know* what a bitcoin address is, and it's not a URL. You don't need to share a wiki page with me, you're the one who apparently didn't know what it was... Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407151 Share on other sites More sharing options...
help_me_with_php Posted January 20, 2013 Author Share Posted January 20, 2013 Lets not start anything combative Jessica...I'm waiting for a response to the first 2 questions. No worries, I don't insult people. Well, lets just say *most* of the time. Don't worry though, there's no bone to pick here with you. Everything's fine. Take it easy. Maybe someday you and I will understand each other's humor. Have a good day. =) Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407154 Share on other sites More sharing options...
kicken Posted January 20, 2013 Share Posted January 20, 2013 1) Can template files be found on the web, and if so can you point me to a reputable place that offers the best translations?? Sure, there are sites out there that sell website templates, and a few places that offer some for free. I don't know any off the top of my head as I don't generally seek them out, but a google search should bring some up. As for translation services, you can either use free translation tools like Google translate or higher a company/individual to manually translate something for you. The later usually provides a better translation, but is costly. The former is usually acceptable. Just depends on what you want/need. Again I don't know of any translation companies, if I need something translated I typically just use google. [2) Are the use of these files a separate process in a web application or are they part of a site databases somehow and reference via simply querying (hopefully you haven't already answered that). Typically they are stored in separate files. The template file contains all your HTML code and placeholders for your dynamic content. Your PHP script will determine which template file it needs to show and then process it and output the final result. Processing the template could be as simple as include'ing it or you could use something more complex such as Smarty or Twig. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407165 Share on other sites More sharing options...
help_me_with_php Posted January 21, 2013 Author Share Posted January 21, 2013 Sure, there are sites out there that sell website templates, and a few places that offer some for free. I don't know any off the top of my head as I don't generally seek them out, but a google search should bring some up. or higher a company/individual to manually translate something for you. The later usually provides a better translation, but is costly. The former is usually acceptable. Just depends on what you want/need. Again I don't know of any translation companies, if I need something translated I typically just use google. Kicken, I won't go very much further on this but I think we may be on different pages here. I understand that this: The template file contains all your HTML code and placeholders for your dynamic content. Your PHP script will determine which template file it needs to show and then process it and output the final result. is how dynamic websites work. That's not much of an issue. But I was under the impression that it was soley the job of PHP to present ways of translating the language of the page through a user-defined request (e.g. => dropdown option). This: As for translation services, you can either use free translation tools like Google translate confuses me just a tad bit. Are you saying that you can use things like this in a PHP webapp? code.google.com/p/php-google-translator/ That seems like what I'm looking for here. Programs like Google Chrome offer translation automatically depending on your IP address (I think) and the default language that you have set, but that is to be expected. The reason for my follow up here is that I didn't think PHP was smart enough to translate automatically just using script alone. Does this make sense? Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407184 Share on other sites More sharing options...
kicken Posted January 21, 2013 Share Posted January 21, 2013 is how dynamic websites work. That's not much of an issue. But I was under the impression that it was soley the job of PHP to present ways of translating the language of the page through a user-defined request (e.g. => dropdown option). Your templates would contain the HTML for the drop down box to select the language. Your PHP code would process the selection when it was changed via a form submit or whatever. Whenever it comes time to display your templates you'd check what the current language is and load the appropriate template for that language. Alternately you could load the same template and just use phrase translation to alter all the different phrases used. confuses me just a tad bit. Are you saying that you can use things like this in a PHP webapp? code.google.com/p/php-google-translator/ No, I was saying that you would just go to google in your own browser, translate whatever you need to translate, then save those translates in your database. There may be some API to allow some degree of automation though, dunno. Translating your stuff is something that involve you actually going and creating all the different translations for your content and storing it somewhere. There's not any PHP snippet that you can just stick in your site and have everything automagically translated for you. If you want something like that then just let your end users go to google and translate the site if they want to. Google has a little JS widget you can stick on your site also and handle translations that way if you want. For solutions such as those you don't need to do anything at all on the PHP side of things though. Just code your site in whatever your main language is and let google handle the rest. Quote Link to comment https://forums.phpfreaks.com/topic/273404-language-choice-offering-in-a-webapp/#findComment-1407210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.