SDL Trados Studio XLIFF global attribute has been already declared - xliff

Not sure if this is the right place to ask the question, but...
I've got the following xliff file:
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file original="file1.txt" datatype="plaintext" source-language="de-de" target-language="en-us">
<body>
<trans-unit id="unit_5">
<source xml:lang="de">unit_5</source>
</trans-unit>
</body>
</file>
</xliff>
I try to open the document as "translate single document" and get the following error from the image below. What might it be?.

I just opened your xliff file in Trados Studio 2014 (SP1) without any error messages coming up. I am afraid I do not really understand what Studio was complaining about for you: the file looks fine to me.
Did you try to disable schema validation in the file type settings for XLIFF, just as a workaround?
Best,
Jenszcz

Generally, file[source-language] and trans-unit[xml:lang] should have the same value. I'm not sure if it's allowed to use different notations (de, de-de).
Also, I've found Trados to be a bit strict and sometimes you'll see that even if the specs allow for some elements to be missing, in some cases Trados still expects them to be present. I'd try putting the target node inside trans-unit and see if it works.

From the XLIFF 1.2 spec:
The optional xml:lang attribute is used to specify the content language of the <source> this should always match source-language as a child of trans-unit but can vary as a child of alt-trans.
So I think it's probably the mismatch between de and de-de that is causing the complaint. You could align these values, or just remove xml:space from the <source> element entirely, as it is optional in this context.

Related

How to create a DNN widget?

If I understood correctly, DNN widget is a way to add a js to every page on the website using module or theme. Right?
My goal evantually is to add a js to every page on a portal and preferably to do that via module that has no need to be added to every page manually.
My plan B is adding module and using setting "Display Module on All Pages", but widget seems to be a better way to do that.
At first I've tried to use this instruction. I've added the YourCompany.Widgets.SampleWidget.js file to root of existing DNN module. Also in the .dnn manifest file inside components tag I've added another component like this:
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
<widgetFile>
<name>license.txt</name>
</widgetFile>
<widgetFile>
<name>releasenotes.txt</name>
</widgetFile>
</widgetFiles>
</component>
I've got this error on module installation:
Failure File specified in the dnn could not be found in the zip file: - D:\Projects\website.com.ua\Host\Install\Temp\vp1vioj1\YourCompany.Widgets.SampleWidget.js
vp1vioj1 part is changing every time (seems like it's some unique id that is generating on module install).
Then I tried to place this widget component inside another package tag after checking this article. Like this:
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="ModuleName" type="Module" version="00.00.01">
<!-- some module content here -->
</package>
<package name="YourCompany.SampleWidget" type="Widget" version="00.00.01">
<components>
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
</widgetFiles>
</component>
</components>
</package>
</packages>
</dotnetnuke>
But I still got the same error on install. I didn't find any other instructions or documentations regarding widgets. When I tried to check the DNN source code - it seems to be also very time consuming and hard way.
So could you please help me to clarify this?
Support for Widgets in DNN Platformnwas dropped a number of years ago.
Your best option if you want something ok all pages would either be to look at a SkinObject, like the breadcrumb or Login for example. Or a traditional module but marking it “display on all pages”
First, you might want to take a look at the concept of DNN Extensions and how they are built and packaged.
If examples of versions DNN extensions, https://github.com/WillStrohl/dnnextensions. The examples include a widget. So check it out.
Now, what you posted looks like a .dnn file, which the the manifest file that is intended to be a part of a packaged DNN extension. Code and other bits and pieces go into the packaged extension (really a specially named zip file). The packaged extension is installed into your DNN installation via the Extensions Persona Bar page (click the Install Extension there).
From my experience with DNN (2006 to now), I believe that I can say that a DNN Widget is something that I've never had anything to do with. So, you may be barking up an old any dying tree in the project.
If you want something included on every page, it makes more sense to include it in the theme (skin). If you want a javascript file, add that to your theme project and have the .ascx files include it, probably using https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html (see https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html)
But, if you are determined to use a widget, start with https://www.kalyani.com/blog/2009/12/25/dotnetnuke-widgets-guide-part-1-of-4/

VS13/VS15 - can't import SQL snippet

I would like to create SQL snippet in VS2013 and VS2015. I don't know why, but I've got an error while importing (in both of VS):
"C:\sql.snippet: Missing or unspecified Language attribute"
My snippet:
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="SQL">
<![CDATA[select * from MyTable]]>
</Code>
</Snippet>
</CodeSnippet>
What's wrong?
The language SQL should be OK https://msdn.microsoft.com/en-US/library/ms171418.aspx#code
I tried to add this snippet to language "Miscrosoft SQL Server Data Tools, T-SQl..."
If I've changed the language attribute to e.g. CSharp it works.
Instead of:
<Code Language="SQL">
Write:
<Code Language="SQL_SSDT">
Visual Studio supports only MSSQL Server Data Tools & T-SQL Language Scripts, not SQL like SSMS does.
Try this.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="SQL">
<![CDATA[select * from MyTable]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
You could also check this out if it works but still gives a warning.
http://providersweb.blogspot.se/2016/01/visual-studio-snippets-missing-or.html
I have been getting a list of messages in the Snippets output window
when I load a project that a number of snippets had a 'missing or
unspecified language attribute' and could not figure out why these
messages appeared. I had checked the Language attribute on the
snippets and they were correct, but still got the message. I had set
up folders for each language type, but still got the messages. I
finally figured out that I had specified they all were VB snippets in
the Snippet manager and those that were not VB would cause the
messages in the output window, ie when loading a VB project, the
CSharp snippets would generate the error message. I fixed this by
going into the snippet manager and specifying the Language, VB or
CSharp, and adding the snippets to the correct language and removing
them from the invalid language. And now these messages of invalid
language attributes do not appear on my output screen.
The language attribute value you used, SQL, is correct. From the VS2015 Code Snippets Schema Reference:
Errors such as you're seeing can happen if you're editing a snippet file directly in one of the folders known by the Code Snippets Manager. Evidently Visual Studio holds its own metadata in addition to what's in the snippet XML itself. For this reason, it can be best to do the edits in a temporary folder and then use the Import button.
For example, I kept getting the error "Missing or unspecified Language attribute" when saving any edit to my new C# snippet in the My Code Snippets folder—or so I thought. Turned out I was in the Visual Basic\My Code Snippets folder, and there's also a Visual C#\My Code Snippets folder which is where I should have been. This was a silly mistake but it illustrates that the "Language" XML attribute isn't enough, as Visual Studio has its own internal conventions to do with different folders for different snippet types (and who knows what else) which all happens when the Import button is used.
I removed my snippet file to a temporary location, and then added it from there using the Import button. As soon as I did this, the problem went away and the snippet started working normally.

Exporting code style settings from IntelliJ IDEA version 14.1.5

I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at https://confluence.jetbrains.com/display/IntelliJIDEA/Code+Styles and http://forum.shakacode.com/t/sharing-your-intellij-rubymine-webstorm-codestyle-among-developers/240, which seems fairly simple.
Unfortunately that is not how my 'export settings' pane looks like, and I don't have a line that says 'code styles'. Mine looks like
The closest I can find is the line I highlighted which has CodeStyleSettingsManager in it along with a whole bunch of other stuff. However I tried using that and extracted the .jar file only to find that there was nothing much inside at all.
Does anyone know a way of exporting code styles that works with the latest version of IntelliJ?
Edit: My codeStyleSettings.xml file only contains the following:
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value/>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
</project>
I don't understand, why you don't see Code Style in your list (it appears in my IDEA 14.1.5), but...
(...) export my code style settings so that they can be used by all developers working on a particular project
A better way to share the project code style across all developers is to include it in your VCS repository. Pulling such a commit will apply those code styles automatically. This is the file: project/.idea/codeStyleSettings.xml. If your VCS is set to ignore .idea/, add an exception for this file.
If you don't see this file at all, you're probably using a local formatter and your Project scheme is unchanged. In this case, go to Settings > Editor > Code Style > Scheme: Manage, select your formatter and click Copy to Project.
Update
Code style files only state the difference to the IDEA Default Code style (which is always the same). You can try this yourself: create a new project, go the the Code Style settings, select Project and change only one option. The codeStyleSettings.xml file will be created, and it will contain only this one option. If you could export your code style settings, the output would be exactly the same.

Multiple CodeSnippet in an XML .snippet file

I'm attempting to supplement the help features for my code by providing other developers with code snippets. These produce skeletons of code which demonstrate how to use/call my classes or methods.
I've created a .snippet file and have placed it in the "%Visual Studio Folder%\Code Snippets\Visual Basic\My Snippets" folder. I've used the Code Snippets Manager and ensured that it included this folder so that I can access the snippets.
Everything works well when I have 1 CodeSnippet tag within the root CodeSnippets tag....
When I add more than one CodeSnippet tag to the file (each with their own title, and their own code example) I'm experiencing something strange.
The first CodeSnippet I've added contains code for adding something to my system, the second contains code for editing something in my system, and the third deleting something from the system.
When I use the code snippet by right clicking and selecting "Insert Code Snippet", only the first code snippet in the file shows up as an option. When I select it, the code in the first CodeSnippet is inserted....but so is the code within the other CodeSnippet tags.
Do you have to have a separate XML .snippet file for each code snippet you want to make available?
After reading through MSDN about creating Code Snippets I was under the impression that this could all be done within one file.
It seems that I'm not understanding something very basic here and would love to find the answer but apparently Code Snippets are under used so finding the answer has proven to be a little trickier than I first thought it would be.
Thanks,
-Frinny
Do you have to have a separate XML .snippet file for each code snippet
you want to make available? After
reading through MSDN about creating
Code Snippets I was under the
impression that this could all be done
within one file.
I create and use snippets all the time. I wanted to do exactly what you intend. But, I have never gotten multiple snippets in one file to work. I also was under the impression you could do this. I even found an article, based on the beta version of Visual Studio, that demonstrated how to do this, but it didn't work. Moreover, the documentation states:
CodeSnippet Optional element. -
Parent element for all code snippet
data. There may be zero or more
CodeSnippet elements in a CodeSnippets
element.
I eventually gave up and created separate files. I have not tried multiple snippets in one file with VS2k8 yet.
Update
I cannot get VB to support multiple snippets in one file using VS2k8. I used the following snippet as a test case. Snippet taken from http://msdn.microsoft.com/en-us/library/ms165394.aspx. Only the first CodeSnippet is read/loaded/used. I also counted all CodeSnippet elements in all snippet files (1143) and no file has more than one. Moreover, this snippet duplicates the behavior you noted in your question. Using the snippet inserts both message box statements.
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
SECOND Snippet
</Title>
</Header>
<Snippet>
<Code Language="VB">
<![CDATA[MsgBox("SECOND SNIPPET")]]>
</Code>
</Snippet>
</CodeSnippet>
<CodeSnippet Format="1.0.0">
<Header>
<Title>
FIRST Snippet
</Title>
</Header>
<Snippet>
<Code Language="VB">
<![CDATA[MsgBox("FIRST SNIPPET")]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
More Info
I got to thinking that this has to be a bug that slipped through because Microsoft never put multiple snippets in the provided snippet files that come with Visual Studio, or VB.NET doesn't support multiple snippets due to difficulties integrating with the enhanced statement completion capabilities of the editor.

How can I get <asp:menu> working in Safari?

On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?
Thanks for the advice, it led me into the following solution;
I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;
<browsers>
<browser refID="safari1plus">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
</controlAdapters>
</browser>
</browsers>
As I understand it, this tells ASP.NET not to use the adaptor it would normally use to render the control content and instead use uplevel rendering.
You can use ControlAdapters to alter the rendering of server controls.
Here's an example:
http://www.pluralsight.com/community/blogs/fritz/archive/2007/03/27/46598.aspx
Though, in my opinion it might be equal amount of work to abandon the menu control for a pure css one (available on many sites).
Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...
The best and simplest solution I've found for this problem is to include this bit of code in your page_load event.
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
Request.Browser.Adapters.Clear();