When I export the xml file of a multiple choice question, it contains the following lines:
<idnumber>arbitrary_id_set_by_user</idnumber>
<answernumbering>ABCD</answernumbering>
<tag></tag>
Is there a way to add idnumber, answernumbering and tag to the metainformation section of the question so that r-exams can export to moodle XML as <idnumber>idnumber</idnumber>,<answernumbering>ABCD</answernumbering>, <tag>tag1</tag>, and <tag>tag2</tag> etc?
The <answernumbering> tag can be set in exams2moodle() via the answernumbering= argument, see ?exams2moodle. The reason for this is that this is set in the same way for all exercises in a quiz. This is more consistent than setting it individually and potentially inconsistently in the meta-information of the different exercises.
The <idnumber> tag appears to be used by Moodle only for internal purposes. It is also not mentioned in the official Moodle XML documentation at https://docs.moodle.org/311/en/Moodle_XML_format. Hence we did not implement it in exams2moodle().
The <tag> is currently not supported in exams2moodle() because we felt that it would be more important to have tags in the Rmd (or Rnw) exercise itself and not the Moodle version of the exercise. For structuring the content on the Moodle side the exsection meta-information can be used, see boxhist for a worked example.
Finally, you can add arbitrary metainformation by using the exextra tag. This is used, for example, in the essayreg exercise template. However, there is no general way of using this extra metainformation to insert additional XML code in the exams2moodle() output. To do that, the source code underlying exams2moodle() would have to be adapted correspondingly.
As mentioned in CakePHP 3.6.10 Translate behaviour not showing 'defaultLocale' values the default language values should be saved in the source table so they can be used as a fallback for empty fields in other languages.
However I have a problem building the forms for this. I have 5 languages (locales): en_US, nl_BE, fr_BE, de_BE and ru_RU. The defaultLocale is en_US. So to ADD a new record I did:
// for the defaultLocale
echo $this->Form->control('title');
// for all other languages I iterate over every language except of the defaultLocale
foreach ($supported_locales as $key => $val):
if ($key !== $default_locale):
echo $this->Form->control('_translations.' . $key . '.title');
endif;
endforeach;
This works fine. Allthough I'm not sure if this is the proper Cake-way to do it?
But in the VIEW (using a disabled form) and EDIT the defaultLocale field
echo $this->Form->control('title');
shows the translated value of the selected locale at that moment instead of the defaultLocale which is saved in the source table. F.e. when you switched the language to Russian at that moment you'll get to see:
English: Русский титул
Dutch: Nederlandse titel
French: Titre français
Deutsch: Deutscher Titel
Russian: Русский титул
So you're missing the value for the default locale (English) because it's replaced by the value for the currently selected language (here Russian). And you're not able to edit the value for the default locale when you're using the page in another language.
Am I overlooking something and is there a easier way to make this work 'out of the box'?
You must make sure that you fetch the records in the default locale, irrespectively of the current environments locale. You can do so using the translate behaviors setLocale() method (locale() before CakePHP 3.6), to explicitly set the locale to use for a specific repository, for example:
$locale = \Cake\Core\Configure::read('App.defaultLocale');
$this->Articles->setLocale($locale);
$query = $this->Articles->find('translations');
This will retrieve the articles in the configured default locale, irrespectively of what might have been set via I18n::setLocale(). If you are including associations where you need the locale applied too, then you have to explicitly set the locale for them too, ie:
$this->Articles->setLocale($locale);
$this->Articles->Comments->setLocale($locale);
$query = $this->Articles->find('translations')->contain('Comments');
See also
Cookbook > ORM > Behaviors > Translate > Retrieving one language without using I18n::locale
Sparx Enterprise Architect offers the possibility to define custom layouts for list views in the package browser and to save these definitions. When exporting a Project file (*.eap) via xmi, these definitions are not included in the export-file and thus lost. I wonder whether there exists a way to transfer columns layout definitions between two EA-Projects.
Many thanks in advance for every hint!
As Geert suggested the layout is stored in the registry.
[HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\OPTIONS]
holds a key PKG_BRWSE_LAYOUTS with the comma separated list of profile names (so you better don't use comma in your profile name ;-).
The detailed information is stored in
[HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\EA1200Workspace\BCGPGrids\EA_ELEMENT_LIST_<name>BCGPGrid-0]
where <name> is the according profile name.
For a sample layout here they looked like
"Columns"=hex:11,00,01,00,00,00,01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00
"ColumnWidth"=hex:11,00,16,00,00,00,04,01,00,00,50,00,00,00,50,00,00,00,50,00,\
00,00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,\
00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,00,50,00,00,00
"ColumnOrder"=hex:08,00,00,00,00,00,01,00,00,00,06,00,00,00,02,00,00,00,0d,00,\
00,00,0e,00,00,00,0f,00,00,00,10,00,00,00
"Groupping"=hex:00,00
"LastFieldChooserPos"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"IsFieldChooserVisible"=dword:00000000
"IsFieldChooserThemed"=dword:00000001
"SortColumns"=hex:00,00
I have to leave that to you to decipher the coding used here. But for a pure ex-/import you probably don't need to do that.
I use TYPO3 6.2 and the Extension shariff. The default language of this extension is english, but the buttons are always translated to german. My website is multilingual (en, de). The Buttons are included via backend for both languages. How could I define the language per content element "Shariff Social Icons"?
Please clarify your question a bit. What do you mean by "language per record"?
The language is detected automatically from the language configured for the current page. So it automatically adjusts if the language is changed.
See also: https://docs.typo3.org/typo3cms/extensions/rx_shariff/Installation/Index.html#fluid-view-helper
If you need to set a language manually you can do that via the data-lang attribute.
You can add override for Shariff Index.html by copying typo3conf/ext/rx_shariff/Resources/Private/Templates/Shariff/Index.html to typo3conf/ext/YourExtension/Resources/Private/Templates/Shariff/Index.html (your extension / override template path)
And add following override to setup typo-script:
plugin.tx_rxshariff.view {
templateRootPaths{
2 = EXT:YourExtension/Resources/Private/Templates/
}
}
Add your modification to your overridden file (typo3conf/ext/YourExtension/Resources/Private/Templates/Shariff/Index.html).