cancel
Showing results for 
Search instead for 
Did you mean: 

Change repository language using APIs

Solved
Occasional Contributor

Change repository language using APIs

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

Forums are fun. Let's post.
Tags (3)
4 Replies
Administrator

Re: Change repository language using APIs

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.

MEGA

Re: Change repository language using APIs

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?

Jerome
Administrator

Re: Change repository language using APIs

Hello,

 

Please find the link related to your issue:

http://community.mega.com/t5/custom/page/page-id/mega-kb?sid=50120000000mrAlAAI

See you.

 

MEGA

Change repository language using APIs

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

 

Jerome