spsottawa 2016 Tower of Babel Reaches the Cloudx

Download Report

Transcript spsottawa 2016 Tower of Babel Reaches the Cloudx

December 3rd, 2016
WELCOME
SHAREPOINT SATURDAY OTTAWA
When Your Tower of Babel
Reaches the Cloud:
Languages and Office 365
MARTIN LAPLANTE
CEO, ICEFIRE STUDIOS, CANADA
SUMMARY
• Tower of Babel
• Language & MUI in SharePoint 2016 & O365
• User Language Settings
• Brief Demo
• Localizing Add-ins & Provisioning (bits of code)
• Machine Translation
Tower of Babel: Quick Recap
•
After the great flood destroyed everything, God put a rainbow in the cloud.
•
It was the promise of a new relationship.
•
Cloud: scary→ reassuring.
•
Noah’s descendants wanted to build a tower that would reach the cloud.
Genesis 11
A tower, whose top may reach unto heaven
•
Because humans are one people with one language, anything that they want to do is
possible.
•
•
•
But God decided to go down there and confound their language, so they can’t collaborate.
God scattered them by language upon the face of all the earth.
The project to reach the cloud was abandoned.
2016/O365 and Languages
•
Variations
•
Managed Metadata
•
MUI (Multilingual User Interface)
•
Machine Translation
What you will learn
•
•
•
How to set up everyone so that O365 is in their language
•
Branding so that it’s in their language
If something is not in their language, how to diagnose
Provisioning sites in their language
•
•
Localization of master pages JS injection
Integration and add-ons in their language
•
Localization of web app add-in parts
• SharePoint-hosted (same server, distinct domain, JS runs in browser)
• Provider-hosted (3rd party server)
Change Default Language
of an O365 Site Collection?
•
MSFT support:
• “If the requirement is strong for your organization, from our back end, we can help change it. However,
•
•
•
we need to delete all site collections and re-create them, which also means all data will be deleted.”
For My Site, this will also delete every user’s OneDrive for Business documents.
Ouch! Easier to segregate users by language?
Your choice: great flood that destroys all, or scatter your users upon the face of all the earth?
• Or you can use MUI
Multilingual User Interface
• Site has a base language
• Site can have alternate languages
• User has language preferences
• Many SharePoint UI elements can follow user’s language
• Some customization / 3rd party components can follow UI language
USER LANGUAGE SETTINGS
What Sets User MUI Language?
•
•
2007: Site’s base language only, no alternate languages
•
2013: Browser or user profile
• Webparts: user language
• Add-in parts: depends
•
O365: It’s complicated
2010: Menu toggle sets cookie
• Webparts: some use site language, others user language
7+ Language Settings
O365 Account
My Profile
O365 Profile
O365 Account
language
Profile
language
list
On change,
changes profile
setting
Ignore browser if
this list overlaps
site languages
SP site settings
Base language
Alt languages
Which one?
Add-in site settings
Base language
Alt languages
Make them match ↑
Browser settings
Browser
language
ranked
list
First one on the list
that matches base or
alt language.
Mapping: regional
variants
How O365 Differs From 2016
•
•
•
•
•
No language packs to install
O365 account overrides SharePoint profile
User settings changes take time to propagate
Now you may have to get users to change their browser settings
Admin personal settings matter
• Default language & localization of add-in seems based on UI language of whoever installed the add-in.
•
(More later)
Default language for O365 site collections depend on country of person who set up account, including
mySite, OneDrive, Search Center
O365 Profile Settings
Delay in Profile Change
Effects of Profile Change
• Some O365 bits change right away
•
Delve, Video, top of page
• Some change with a few minutes delay
•
•
Sites (if alternate language is defined)
SharePoint-like (Newsfeeds, Video)
• Some components follow O365 Account settings
•
•
Mostly
•
Outlook (also own setting)
browser settings
Sway (after time out), PowerApps, Flow
• Separate settings
•
•
Word Online, Excel, PowerPoint, Yammer, Power BI
OneNote Online?
OneDrive Behaves Like
SharePoint
O365 Account Settings
Effects of O365 Account
Settings Change
•
Affects many pages and page components regardless of other settings
•
Adds itself as top language preference in your profile
•
Even if deleted, it may override browser settings if it is one of the site alternate
languages
•
Seems to depend on which you change last (unconfirmed)
Changes Propagate
at Different Rates
English → Spanish → German
Which Language Setting
is Better?
• Site language & alternate languages are necessary but not sufficient
• O365 Profile: time to propagate
• O365 Account affects more components but takes more time to propagate
• The instant toggle trick
The Instant Toggle Trick
1. Account setting that has no overlap with base + alt languages
2. Profile setting blank, or no overlap with base + alt languages
3. Go home, come back tomorrow
4. Now change browser settings
• Effect is instantaneous, but training needed
DEMO
Localizing Add-ins
• Localization vs. Globalization
•
Site Language vs. User Language
• At time of creating add-in site, template elements set according to site or user
language
•
Stays in that language even when user selects alternative language
• At run-time, change the display using JS file selected according to user UI
language
Resource Files
•
On Premise: .resx files are loaded at run time
•
•
•
When your C# code refers to them
Language determined by thread CurrentUICulture (user language)
O365: custom .resx loaded once
• Loaded at add-in install time – makes 1 language permanent
• Language of the person who installed the add-in
• Provisioning has other use for resx files
•
SharePoint’s own .resx loaded at run time based on user language
Globalize Add-ins
•
SharePoint-hosted or injected branding JS files
• Language-specific “Resources.nn-NN.js” file solutions
•
•
•
Remote components: Request.QueryString["SPLanguage"]
•
Note: add-in domain may not have same alternate languages activated
Add-in domain has no easy access to user language in host domain (JS XSS security)
However, if alternate languages match, then user language matches
• {add-in web name} /_layouts/15/muisetng.aspx
JS for Globalization
Based on User Language
• Load language-specific JS file Resources.nn-NN.js
<script type="text/javascript" src="../scripts/Resources.<SharePoint:EncodedLiteral runat='server'
text='<%$Resources:wss,language_value%>' EncodeMethod='HtmlEncode' />.js"></script>
• This JS file should contain localized string values
var localizedheading = "Librería";
• Replace strings using JS
<h2 id="heading">Bookshop</h2>
<script type="text/javascript"> window.onload = function () {
document.getElementById("heading").innerText = localizedheading;
}
</script>
Localized PnP Provisioning
• PnP Localization using .resx & tokens, based on Site Language
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2015/12/ProvisioningSchema">
<pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.0.1601.0, Culture=neutral, PublicKeyToken=null" />
<pnp:Localizations>
<pnp:Localization LCID="1033" Name="English" ResourceFile="SiteTemplate-en.resx"/>
<pnp:Localization LCID="1043" Name="Dutch" ResourceFile="SiteTemplate-nl.resx"/>
</pnp:Localizations>
<pnp:Templates ID="CONTAINER-TEMPLATE-8C075A44E60F4E82B8F013637DB1E654">
<pnp:ProvisioningTemplate ID="TEMPLATE-8C075A44E60F4E82B8F013637DB1E654" Version="1">
<pnp:Lists>
<pnp:ListInstance Title="{resource:myListTitle}" Description="{resource:myListDesc}" DocumentTemplate="" OnQuickLaunch="true"
TemplateType="105" Url="Lists/my" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="0" TemplateFeatureID="00bfea71-7e6d4186-9ba8-c047ac750105" EnableFolderCreation="false">
• Token identifiers, all equivalent:
{localization:<key>} , {localize:<key>} , {loc:<key>} , {resource:<key>}, {res:<key>}.
Globalized Provisioning
• Add Alternate languages to sites
•
$web.IsMultilingual and $web.AddSupportedUILanguage(nnnn)
• SetValueForUICulture method of TitleResource and DescriptionResource
private static void GlobalizeSite(ClientContext cc, Web web)
{
// Globalize the site title.
web.TitleResource.SetValueForUICulture("en-US", "Hello World");
web.TitleResource.SetValueForUICulture("fr-FR", "Hello World - French");
// Globalize the site description.
web.DescriptionResource.SetValueForUICulture("en-US", "Hello World site sample");
web.DescriptionResource.SetValueForUICulture("fr-FR", "Hello World site sample - French");
web.Update();
cc.ExecuteQuery();
}
• Works for Web, List, ContentType, and Field
User Provisioning
• PowerShell
• Set SPS-MUILanguages User Profile property
• Set user’s PreferredLanguage in Azure AD, or in Local AD with AAD Connect
• Or directly using PnP User Profile Updater
• O365 user account: New-MsolUser , Set-MsolUser
-PreferredLanguage
• Exchange Online & Outlook Web App,
Set-MailboxRegionalConfiguration
MACHINE TRANSLATION
French says: “Buff the sausage”
SharePoint’s
Machine Translation Service
• SharePoint Service Application
• Connects to Microsoft Translator
•
•
•
•
Similar back end to Bing translation engine
Custom version for SharePoint users
Statistical engine, now with deep learning
On-premise – you can set it up to train with your own documents
• Used in Variations
• Used in Managed Metadata
• Available through API
Machine Translation
Has Some Risks
Machine Translation Service
is Sometimes Unavailable
Check Translations with Context
• ¡Oye! ¿Cómo se escribe “papa” en Inglés?
• “Potato”.
• Gracias.
Machine Translation:
In General, Translate or Not?
•
What machine translations not to rely on
• Published web pages
• Documents on site
• Confidential information
•
What to translate with MT
• Ephemeral content
• External content for crude translation (gisting)
• First drafts of internal translation
•
•
For professional translators not helpful, they have better tools
Short & repetitive texts that it got right before
Machine Translation:
Write for Translation
• Microsoft Global English experiment
• Microsoft Manual of Style
• Global English Syntax
•
•
•
•
•
•
Use short sentences
Avoid sentence fragments
Use optional pronouns – that, who
Use optional articles – the
Use optional punctuation
Keep adjectives & adverbs close,
watch “only”
• Machine Translation Syntax
•
•
•
•
•
But not too short
Present participle vs. gerunds
Past participles vs adjectives
Limit coordinate conjunctions – and, or, but
Capitalize correctly
DEMO: STILL GOING?
THANK YOU FOR COMING
More questions?
[email protected]
or IceFire booth at the Expo
SPS Ottawa is made possible by our Sponsors!
Platinum
Gold
Silver
Bronze
Bronze
Summerhays Grill
5:30 pm
1971 Baseline Road (corner of Woodroffe)
Please drink responsibly . We will be happy to call a cab for you