how to Untranslated an image from a macro ?

Hi,

 I try by macro to untranslated an image in passolo 2018 18.0.178.0

The image comes from a .CHM file. My first image it's the Resource(6).

I can provide the lpu if you need.

When I try to change the value for the state of pslStateTranslated

The debugger stop and  I received the error on execution 

128) This state flag can not be set for this resource. 

On this line

prj.TransLists.Item(1).Resource(6).State(pslStateTranslated)= False

 

Set prj = PSL.ActiveProject 

If (prj.TransLists.Item(1).Resource(6).IsBinary )then

     If (prj.TransLists.Item(1).Resource(6).State(pslStateTranslated)) Then   

          ‘ import the source image in the translated list        

          filename = prj.TransLists.Item(1).SourceList.Resource(6).IDName       

          target2 = prj.TransLists.Item(1).SourceList.Resource(6).ExportBinary("D:\test",fileName)       

          prj.TransLists.Item(1).Resource(6).ImportBinary(target2)     

           ‘ try to set the image to untranslated. 

          prj.TransLists.Item(1).Resource(6).State(pslStateTranslated)= False       

          prj.TransLists.Item(1).Save 

     end if

end if

 

If this is the right way to untranslated an image?

emoji
Parents
  • I think that the error message correctly described the problem. String entries of type PslTransString have a state property pslStateTranslated, but not items of type PslResource. It is not really clear, what you want to achieve as it is not really best practice to have pictures with translatable content. Sometimes it can't be prevented.

    emoji
  • Hi Achim,

    In the help file have a picture of the user interface translated. I can't leave the picture of the user interface in English in the French version of the help file.

    I don't have choice to importbinary translated picture.

    My goal it's to untranslate an image. Like we do for a string. When you click un the red X to delete in the input box, the state return like to be before you translate.

    I want to be in same state before I importbinary the image. What are the step I need to do?

    The actual result I have are :

    If you create a new project with a new language, you check by macro the state for the image is :

    prj.TransLists.Item(1).Resource(6).State(pslStateTranslated) is False

    if you try to export the translated image, you have no file generate. 

    prj.TransLists.Item(1).Resource(6).ExportBinary("D:\test",fileName) .

    After import binary

    prj.TransLists.Item(1).Resource(6).ImportBinary(target2)

    If you test state fater  it's true

    prj.TransLists.Item(1).Resource(6).State(pslStateTranslated) is True.

    My goal it's to delete the translated image and have the state = false.

    Also in the user interface I can't find a way to untranslated a specific image. I ask the support and they can't find the way too.

    Thanks for your help 

     

    emoji
Reply
  • Hi Achim,

    In the help file have a picture of the user interface translated. I can't leave the picture of the user interface in English in the French version of the help file.

    I don't have choice to importbinary translated picture.

    My goal it's to untranslate an image. Like we do for a string. When you click un the red X to delete in the input box, the state return like to be before you translate.

    I want to be in same state before I importbinary the image. What are the step I need to do?

    The actual result I have are :

    If you create a new project with a new language, you check by macro the state for the image is :

    prj.TransLists.Item(1).Resource(6).State(pslStateTranslated) is False

    if you try to export the translated image, you have no file generate. 

    prj.TransLists.Item(1).Resource(6).ExportBinary("D:\test",fileName) .

    After import binary

    prj.TransLists.Item(1).Resource(6).ImportBinary(target2)

    If you test state fater  it's true

    prj.TransLists.Item(1).Resource(6).State(pslStateTranslated) is True.

    My goal it's to delete the translated image and have the state = false.

    Also in the user interface I can't find a way to untranslated a specific image. I ask the support and they can't find the way too.

    Thanks for your help 

     

    emoji
Children