Quantcast
Channel: SalamanderSoft - Education Integration » SLK
Viewing all articles
Browse latest Browse all 32

SharePoint Learning Kit 1.7 Localization Changes for SlkSettings.xml

$
0
0

Prior to SLK 1.7, localizing the Assignment List Web Part (ALWP) was difficult in a multi-lingual environment. The query and column titles are stored in the SlkSettings.xml configuration file and can hence be translated and set to whatever you want. In fact the language packs for SLK include localized SlkSettings. However, these would be global across the site collections sharing the same configuration. So although the rest of SLK, the application pages etc, will pick up the language of the site you are on, the ALWP just picks up the string from SlkSettings file which would be just whatever language it is written in. You can change it by naming the query set to use in the ALWP properties, but you need to do that on a web part instance by web part instance basis, and you lose the functionality where it automatically chooses the query set based on your permissions on the site.  Unlike the rest of the localization, it was not transparent and doesn’t just work as you expect.

In SLK 1.7 I’ve added the ability to localize the SlkSettings.xml file. It’s certainly not perfect, and can do with more work on it, but it’s a decent start. Now you can add placeholders for strings and at run-time SLK will replace them with locale appropriate strings which are in the resource files. As an example here is the old version of a query:

  <Query Name="OverdueLearner" Title="Overdue" ViewName="LearnerAssignmentListForLearners" CountViewColumnName="IsFinal">

    <Column Title="Site" RenderAs="SPWebName" ViewColumnName="AssignmentSPWebGuid" ViewColumnName2="AssignmentSPSiteGuid" />

    <Column Title="Assignment" RenderAs="Link" ViewColumnName="AssignmentTitle" ViewColumnName2="LearnerAssignmentId" NullDisplayString="Untitled" />

    <Column Title="Due" RenderAs="UtcAsLocalDateTime" ViewColumnName="AssignmentDueDate" CellFormat="d" NullDisplayString="–" ToolTipFormat="Due: {0:D}, {0:t}" Wrap="false" />

    <Column Title="File Submission" ViewColumnName="FileSubmissionState"/>

    <Column Title="Status" RenderAs="LearnerAssignmentStatus" ViewColumnName="LearnerAssignmentState" Wrap="false" />

    <Column Title="Score" RenderAs="ScoreAndPossible" ViewColumnName="FinalPoints" ViewColumnName2="AssignmentPointsPossible" ToolTipFormat="Score: {0}" Wrap="false" />

    <Condition ViewColumnName="AssignmentSPWebGuid" Operator="Equal" MacroName="SPWebScope" NoConditionOnNull="true" />

    <Condition ViewColumnName="AssignmentStartDate" Operator="LessThanEqual" MacroName="Now"/>

    <Condition ViewColumnName="AssignmentDueDate" Operator="IsNotNull" />

    <Condition ViewColumnName="AssignmentDueDate" Operator="LessThan" MacroName="Now"/>

    <Condition ViewColumnName="IsFinal" Operator="NotEqual" Value="1" /><!– helps SQL perf? –>

    <Condition ViewColumnName="LearnerAssignmentState" Operator="LessThan" Value="2"/><!– i.e. unsubmitted –>

    <Sort ViewColumnName="AssignmentDueDate" Ascending="true"/>

    <Sort ViewColumnName="LearnerAssignmentState" Ascending="true"/>

  </Query>

And now the new version

  <Query Name="OverdueLearner" Title="$Resources:SlkDll,QueryTitleOverdue" ViewName="LearnerAssignmentListForLearners" CountViewColumnName="IsFinal">

    <Column Title="$Resources:SlkDll,QueryColumnTitleSite" RenderAs="SPWebName" ViewColumnName="AssignmentSPWebGuid" ViewColumnName2="AssignmentSPSiteGuid" />

    <Column Title="$Resources:SlkDll,QueryColumnTitleAssignment" RenderAs="Link" ViewColumnName="AssignmentTitle" ViewColumnName2="LearnerAssignmentId" NullDisplayString="$Resources:SlkDll,QueryColumnNullDisplayUntitled" />

    <Column Title="$Resources:SlkDll,QueryColumnTitleDue" RenderAs="UtcAsLocalDateTime" ViewColumnName="AssignmentDueDate" CellFormat="d" NullDisplayString="$Resources:SlkDll,QueryColumnNullDisplayDash" ToolTipFormat="$Resources:SlkDll,QueryColumnToolTipDue" Wrap="false" />

    <Column Title="$Resources:SlkDll,QueryColumnTitleFileSubmission" ViewColumnName="FileSubmissionState"/>

    <Column Title="$Resources:SlkDll,QueryColumnTitleStatus" RenderAs="LearnerAssignmentStatus" ViewColumnName="LearnerAssignmentState" Wrap="false" />

    <Column Title="$Resources:SlkDll,QueryColumnTitleScore" RenderAs="ScoreAndPossible" ViewColumnName="FinalPoints" ViewColumnName2="AssignmentPointsPossible" ToolTipFormat="$Resources:SlkDll,QueryColumnToolTipScore" Wrap="false" />

    <Condition ViewColumnName="AssignmentSPWebGuid" Operator="Equal" MacroName="SPWebScope" NoConditionOnNull="true" />

    <Condition ViewColumnName="AssignmentStartDate" Operator="LessThanEqual" MacroName="Now"/>

    <Condition ViewColumnName="AssignmentDueDate" Operator="IsNotNull" />

    <Condition ViewColumnName="AssignmentDueDate" Operator="LessThan" MacroName="Now"/>

    <Condition ViewColumnName="IsFinal" Operator="NotEqual" Value="1" /><!– helps SQL perf? –>

    <Condition ViewColumnName="LearnerAssignmentState" Operator="LessThan" Value="2"/><!– i.e. unsubmitted –>

    <Sort ViewColumnName="AssignmentDueDate" Ascending="true"/>

    <Sort ViewColumnName="LearnerAssignmentState" Ascending="true"/>

  </Query>

You can see that the values attributes Title, NullDisplayString and ToolTipFormat have been replaced by strings of the format

$Resources:SlkDll,QueryColumnTitleScore

You may recognise this as a standard resource string usage from SharePoint features and pages. It does work like that, but also has an extension that if the source is SlkDll, is then the  resource string QueryColumnTitleScore from the standard SLK resource file. As it’s loading the string from a resource file, then the standard localization process will take place. If you don’t want to use a resource, or to use a different string, you can just replace it with a text string as before e.g.

    <Column Title="Your Score" RenderAs="ScoreAndPossible" ViewColumnName="FinalPoints" ViewColumnName2="AssignmentPointsPossible" ToolTipFormat="Our own tool tip." Wrap="false" />

What this means is that you can have a common SlkSettings file across all your languages, and the ALWP will be translated automatically as long as the language pack you are using has the resource strings in. Currently I’ve only updated 2 of them, English and Welsh, so we will need some language maintainers to add them to the other languages.


Viewing all articles
Browse latest Browse all 32

Latest Images

Trending Articles





Latest Images