11-04-2012 10:42 AM
I need to change the repository language after creation.
I cannot find something clear in the API documentation
Is there a function available for a MegaRepository object to do this?
Please provide a code example
Solved! Go to Solution.
18-04-2012 03:49 PM
Code example for changing repository language with Method ChangeLanguage (VB script):
sEnvPath = "C:\Program Files\MEGA\MEGA 2009 SP5\Demonstration"
sAdministrator = "Administrator"
sAdminPwd = ""
sRepository = "Adventure" 'Target repository
sTargetLanguageName = "Français" 'Target language
'open environnement in administration session
Set oMegaApp = CreateObject("Mega.Application")
Set oEnvironment = oMegaApp.Environments.Item(sEnvPath)
'MsgBox "Environment opened:" & oEnvironment.Name
oEnvironment.CurrentAdministrator = sAdministrator
oEnvironment.CurrentPassword = sAdminPwd
'get repository
Set oRepository = oEnvironment.Databases.Item(sRepository)
'Msgbox "Repository updated: " & oRepository.Name
'change current repository language to target language
oRepository.ChangeLanguage(sTargetLanguageName )
Set oEnvironment = Nothing
'MsgBox "Environment closed"
Set oMegaApp = Nothing
13-04-2012 12:04 PM
Hello,
Please find the link related to your issue:
http://community.mega.com/t5/custom/page/page-id/mega-kb?sid=50120000000mrAlAAI
See you.
11-04-2012 02:56 PM
Thanks François
I now get an error that I cannot understand
I try to change the repository language using ChangeLanguage
oRepository.ChangeLanguage(IdFrLang)
I get the above error
Thread(0688);MEGA Automation Batch Exception : MegaDatabase.ChangeLanguage(0) : error Private: 0x00031001 14:48:18
A MEGA Session cannot be entered for (Database.ChangeLanguage) while the Sessio
n is locked by : Environment C:\Program Files\MEGA\MEGA 2009
SP5\Demonstration, User Administrator : Database is Opened
A this step I have
- an object 'oRepository' (current repository)
- an object 'oFrLang' (object for the language 'Français') that I have obtained with this code
...
Set oRoot = oRepository.Open
Set oFrLang = oRoot.GetCollection("Language").Item("Français")
IdFrLang = oFrLang.GetId
...
What am I doing wrong?
11-04-2012 10:55 AM - edited 13-04-2012 03:13 PM
Jerome,
Thank you for your question.
What you want to do is an important change, see
http://community.mega.com/t5/custom/page/page-id/mega-kb?sid=50120000000mqQrAAI
If you want to do this change here is the solution
http://community.mega.com/t5/custom/page/page-id/mega-kb?sid=50120000000mqvKAAQ
See you in the community.