We want to get the locale / language of a Microsoft Graph user.
We're trying to use mailBoxSettings/language and while for us it works fine, it appears that for a large proportion of our customer's users, there is no language / locale when fetching the information.
Is this normal behavior? Wouldn't any user that has used Outlook at least once have a language field populated?
What would be a better way to get the user's language, hopefully without asking for more scopes?
Related
I am working on an application which supports three languages - English, German a French. There is used Stripe for payments and it is used in a way we have our custom checkout screen. The language of UI is set automatically by browser preferences...
The good thing is that when there is some validation error coming from Stripe elements on frontend it is automatically in the language according to browser preferences.
The bad thing is that when I make a request from backend to Stripe API and there is some error it is always in English. So I need to check all possible error codes and manually assign them a description in proper language (locale can be different in every request from frontend) and then I can send it to the frontend.
The question is - is there any way how to send a request to Stripe API + locale as the option? In order to get an error message in the proper language...
The Stripe API Errors aren't localized to a language (other than English). If you want to localize those, you'd need to intercept them, parse them, and return something else (in the appropriate language). There are actually projects out there that can help you with this though--
https://github.com/ekosz/stripe-i18n
Screenshots and similar explanation found at my post in the AdWords community help forum
Whereas most, usual AdWords conversions center around an event happening on your site (often via Google Analytics), Google now (as of ~6 months ago, I believe) offers the ability to track conversions that occur in Salesforce, automatically, by looking for specified "Opportunity Stages" on the Opportunity object in Salesforce. Example: When a given lead is qualified, and their stage is updated to reflect that, this now counts as a secondary conversion in AdWords.
Now I have normal conversions which measure how many people have created an account, and I can measure how many of those accounts are actually potential customers. I love this. It's automatic and gives us pretty granular insight.
The workflow is:
Lead clicks on search or display ad
Arrives at landing page, is assigned a GCLID
Ideally the lead signs up and self identifies
Code on our site sends all the lead's self-provided information PLUS their GCLID into our database AND into Salesforce, where the GCLID is retained in a separate field (called GCLID)
When that lead is converted to an opportunity in Salesforce, the GCLID transfers from the individual lead to the Opportunity object for the account
AdWords polls once daily at midnight for any opportunities where the GCLID field is filled out AND they have reached a specified stage (post qualification)
When AdWords polls the SFDC API and a record matches those criteria, it imports that GCLID, the date of creation, and the value (field named "Amount") that is assigned to the lead.
AdWords is supposed to measure that 1) the conversion occurred (which it does) and 2) the VALUE of the conversion that is determined by a field in SFDC.
I'm having trouble with step 8. I can see the AdWords import history and it's detecting the conversion AND the value, but the VALUE is not appearing in any AdWords report of any kind. All values associated with that conversion are 0, though the conversions themselves are registering.
I've now spoken with AdWords support reps directly and have solicited advice from their community forum, no luck. Anyone have any idea of why this might happen?
Per this FAQ, it sounds like AdWords looks for the conversion value in the Opportunity's Expected Review field.
The app I'm building needs to be able to match up users to events based on the city/town they're in. I'm still relatively new to Rails and completely new to Geolocation and using locations in an app. I'd figured on a design where users have one or many cities, and events would have one city which I'd hoped to extract without specifically asking the user for it, by getting it from the event address entered.
Mostly to provide some outside checking to help get the address entered correctly and consistently, but also to show a map, I installed this jquery address picker (https://github.com/sgruhier/jquery-addresspicker). Unfortunately the data returned by Google doesn't include a city but a "locality" or an "administrative area" that doesn't correlate reliably to city names. The localities being returned are more like what we in my home town would call "suburbs". What I need to procure is a city so I can allow users to search all events in their city rather than just the ones in their suburb.
Can anyone offer advice on how I could go about doing this? Many thanks.
Edit: Should maybe add that I'm wanting to do geocoding client-side so I don't run into problems with Google Maps limits or have to pay for geocoding etc.
There are some gems that provide you with that and may others geo related features, like calculating distances.
Here are the 2 most famous: https://github.com/alexreisner/geocoder and https://github.com/imajes/geokit
In the future I highly recommend you to head to https://www.ruby-toolbox.com/ to see what is available as a gem already and see what is the most popular at the moment.
For raw address info, use Google Maps API Reverse Geocoding which accepts lat/lon inputs and returns street address components. Modern browsers support location awareness (geolocation), with user permission, and will give you a lat/lon that "tends to be close" to where the browser is. That will probably get you a correct city/town in most cases.
The maps API is part of Google's broad suite of API tools -- there are gems that handle any Google API (well, most of them), or check out Google Maps for Rails, which will at the very least give you a good head start on how to use the API.
But if you're looking to validate postal code, this method will come up short, since the location awareness will vary in accuracy depending on browser, device (more accurate for mobile), the connection, population density, network coverage, and so on. Also, calling the
If you can get GPS-accurate lat/lon then it will be much more accurate ... except in some cases like in large cities, a single building will have its own postal code, so a few feet one way or the other might matter.
How do I go about displaying content based on a users location ? For ex. If somebody accesses the site from the New York , I would like to display New York Hotels . However if somebody accesses the site from Chicago , I would like to display Chicago hotels.
You're looking for a Geoloction database which would give you access to the typical IP ranges for the countries/cities you need to flag.
This is not absolute or completely trustworthy information though. Country level geo-location is mostly effective but anything like city/state/zip code level information should be treated with great caution.
I've worked with major multinational media providers using expensive paid services and discovered that the information in these databases is a very long way from correct and that users individual circumstances often prevent geo-location from being effective.
e.g. Virgin and East Coast trains in the UK use T-Mobile Germany as their onboard internet provider so you appear to be in Germany to many sites and payment processors.
There are quite a few free geolocation databases, MaxMind springs to mind (though this is not a recommendation of their service).
You can find some thoughts on implementing geo-location here
You need some database/api with information about hotells in different locations, then you need to now where the visitor is.
You can use something like Travel/Hotel API's? to find hotells.
And for finding the location of your visitor you can use something like http://www.hostip.info/use.html
or you can use HTML5 geolocation api example http://html5demos.com/geo . The bad thing with the html5 geo api is that the user need to accept before you get their location.
Remember that there is no guaranty that the location is correct...
This is the exact reason I created wpgeocode. WPGeocode is a free plugin for wordpress that enables publishers to customize content based on reader location. Check out the plugin at the support site at http://www.wpgeocode.com
The plugin enables shortcodes that can be placed in your posts or pages. There are many conditional shortcodes such as [wpgc_is_country_code country_code="US"] for this exact purpose. Simple open the shortcode, specify the target country_code and provide the content to be displayed if the reader is visiting from that specific country.
Visit http://www.wpgeocode.com/shortcodes for a complete listing - here are a few:
[wpgc_is_city_and_state city=”Yardley” state_code=”PA”]
[wpgc_is_ip” ip=”xx.xx.xx.xx”]
[wpgc_is_ips” ip=”xx.xx.xx.xx,aa.bb.cc.dd”]
[wpgc_is_not_ip” ip=”xx.xx.xx.xx”]
[wpgc_is_not_ips” ip=”xx.xx.xx.xx,aa.bb.cc.dd”]
[wpgc_is_city” city=””]
[wpgc_is_cities” cities=”city one,city two,city three”]
[wpgc_is_not_city” city=””]
[wpgc_is_not_cities” cities=”city
one,city two,city three”]
[wpgc_is_nearby”] – Uses the value you
specify in the Nearby Range setting from the administrative panel
[wpgc_is_not_nearby”]
[wpgc_is_within” miles=”10″]
[wpgc_is_within
kilometers=”12″]
[wpgc_is_country_name” country_name=””]
[wpgc_is_country_names” country_name=”United States,Egypt,Albania”]
[wpgc_is_country_code” country_code=””]
[wpgc_is_country_codes”
country_codes=”US,GB,AZ”]
[wpgc_is_state_code” state_code=””]
[wpgc_is_state_codes” state_codes=”PA,NJ,TX”]
[wpgc_is_not_country_name” country_name=””]
[wpgc_is_not_country_names” country_names=”United
States,Egypt,Albania”]
[wpgc_is_not_country_code” country_code=””]
[wpgc_is_not_country_codes” country_codes=”US,GB,AZ”]
[wpgc_is_not_state_code” state_code=””]
[wpgc_is_not_state_codes”
state_codes=”PA,NJ,TX”]
dotCMS offers the ability to geolocate content OTB (disclaimer, I work for them). You can see a demonstration that displays news content based on the user's location onthe demo site:
It is pretty easy to setup and use. Any type of content can be geolocated and the content can be accessed through the RESTful API. Under the covers, the Geolocation queries are handled natively via Elasticsearch.
Example:
http://demo.dotcms.com/demos/content-geolocation
Docs:
http://dotcms.com/docs/latest/es-geolocation-queries
What is the best way to determine the language of twitter posts.
There is the language parameter that comes with the streaming API but it doesn't really seem to be very accurate. Even many Japanese posts are labelled as English.
What have others done to sort out the langauges?
I've had very good results with this PHP package:
http://pear.php.net/package/Text_LanguageDetect/
It is fast and open source. We use it to select English only posts for a site we run at http://2012twit.com.
google have language detection within their Translate API if using evil external services is a go-er?
http://code.google.com/apis/language/translate/v1/reference.html#detectResult