-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning localized taxonomy field value labels (GetListItems)... #33
Comments
I assume that was your tweet I just replied to? Did you try passing in the lcid, or are you not calling the TaxonomyClientService? |
I'm talking about calling GetListItems via SPServices, not calling the Taxonomy Service itself. Getting field values, not the available labels. I'm able to get all the terms and labels (for the pick list). |
I'm very surprised the lists.asmx is that smart!
How can I add the "Accept-Language" custom header to the underlying XHR call? |
I've never seen SOAP-UI before - looks really useful. It doesn't look like I've left any hook to pass customHeaders into a request using SPServices. This might make a nice little enhancement. I'm surprised it's never come up before. |
I'm curious as to whether or not the SP 2013/2016 REST API behaves in the same way, or if they've accounted for language in the API contract itself. Do you have a future SPServices release planned? |
I do have a future release planned, but I keep getting busy and not getting to it. I'm looking at the core to see how I can allow you to pass in custom headers. It doesn't seem that difficult. |
FYI... More about global ajax events: http://api.jquery.com/category/ajax/global-ajax-event-handlers/ /Paul |
I've just added a customHeaders option to core so that you can pass in any arbitrary name/value pairs. See headers here. I'm pushing a new set of changes now. It includes a shift to gulp and webpack, and you should be able to build your own version. Right now the syntax is: $().SPServices({
operation: "GetListItems",
listName: "States",
customHeaders: {'Accept-Language':'fr-fr', "boo": "foo"}
}); See if that does what you want. Note that this is an early v2.0 build, but it's coming into focus. |
@purtuga Thanks, that's what I'm working on. Seems this goes much deeper though! While adding the "Accept-Language" header works from outside the browser (.Net code, PowerShell client, SOAP-UI), it doesn't from within (JavaScript). Something else is being sent in the xhr that's causing sharePoint to ignore that header value. I'm strongly suspecting the 'lcid' cookie is the culprit. If this turns out to be the case, achieving what I want is going to be trickier. :-( |
Well, we have the customHeaders capability built into SPServices now, should it ever become useful. |
Hi Marc.
I have a list. The list has a managed metadata field. the associated termset's terms all have French labels added, in addition to English. The farm has the French language pack installed (on top of the default English), and an alternate language has been enabled (French, FR-fr) on the site collection.
If I switch languages in the UI (MUI), the taxonomy field values (labels) in the lists switch. If I get the data via SPServices, I only get the English values (labels).
Let's say I have the following two terms (and labels):
"For Sale": "For Sale" (EN), "A vendre" (FR)
"Wanted": "Wanted" (EN), "Demande" (FR)
After some experimentation using SOAP-UI, I discovered that if I add the _"Accept-Language" header _with a value of "fr-fr", I will get the French label in the taxaonmy Field's value! Ex "12;#A Vendre", which is what I'm after.
If I call GetListItems without an_ "Accept-Language" header_, I get "12;#For Sale" for the field value.
Perfect!
Is there a way for me to pass this custom header value into my SPServices call? I don't want to edit the SPServices JS file itself. I'd also not have to hook into the XHR directly to add the header if at all possible.
(FYI the hidden Note Field attached to the Taxonomy field only returns the English label for both calls, but that's ok.)
Thanks,
Chris
The text was updated successfully, but these errors were encountered: