Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Any way to easily localize indicators ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Any way to easily localize indicators ?

    There was a thread here on embedded resx files :


    Anyway to embed the resx files into the assemblies ?

    I am able to add the ResourceGom.Designer.cs and add the properties corresponding to localized strings, but associated resx files is not picked up by the compiler.

    Thanks

    #2
    Hello,

    Thank you for the post.

    I tried the linked sample and exporting as a compiled assembly, I do see that the resource is inside of the assembly and was able to be used after restarting the platform.

    Are you currently developing the .resx in visual studio? If so, please ensure that the note from the other post is not being overwritten when you resave in visual studio. That is a final step before NinjaTrader can utilize the file.

    If you cannot see your custom file work, I would likely suggest checking if you can import the item from the other post and export it as compiled and see it work. If so, you could compare your current logic and syntax to see where they may differ. I did note that I had to extract the other file as it was created in the beta phase so you would need to manually import the item if you had not already.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      Thanks for the answer

      I copied the SampleAddon.zip in my Addon folder, compiled OK, then exported.

      In dotpeek, you can see the designer class being added (it's a .cs so it's compiled), but the ressource file is not embedded, resources are only the standard Custom resources.

      This is what you were writing in previous post ("Unfortunately, this would still not be of value. Although it works to use the resource, you currently can not export resources as source or compiled assembly.")

      Everything works ok in VS (compiles and embed resource in dll) but
      * How are you able to develop indicators? you can't use F5 anymore in NT since the resource files are not embedded, so Indicators lose their names and are not usable
      * How to you encrypt using Agile.Net ?
      * Even is all the previous works, how to you deliver the language files (the fr-fr, de-de etc subfolders) I tried putting the subfolders and resource dlls in the zip file but they are not copied when importing the zip files.

      Thanks

      Edit : added pic
      Attached Files
      Last edited by gomifromparis; 02-16-2018, 10:35 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        I can see the other sample working on my end and do see that the .resx file was included in the assembly and is usable. I would be uncertain of the image you provided but would suggest instead using the platform to confirm if the resource can or cannot be found. You do need to mirror that other post if you are trying to recreate the same usage of including a resx file. Using custom resource names will likely not work, instead, you would need to use the syntax listed in the other post to correct the designer.cs file, and use the names listed in that sample.


        Regarding the note I had posted, that would still apply for custom named resources but after testing I do see that the result of exporting a compiled assembly has changed since the beta when this was originally brought up.

        Regarding developing indicators

        How are you able to develop indicators? you can't use F5 anymore in NT since the resource files are not embedded, so Indicators lose their names and are not usable
        Are you referring to pressing F5 on a chart and seeing some error, or is this in reference to using Visual Studio and pressing F5?
        If you are referring to VS and its build command, that was never suggested or supported in contrast to NinjaTrader. Visual Studio can be used as a complimentary syntax editor to NinjaTrader but was never intended to do any building. You should use the platform to complete any compile or check for errors. In NT8 there is a addon sample that demonstrates building from a separate visual studio project which in turn builds a separate dll. This does require that you restart the platform to see changes.

        How to you encrypt using Agile.Net
        When using the Platform, the standard export process applies and you can select a protected dll as the export.
        If you are using an external visual studio project to produce a dll, you would need to use the agile.net application to protect that dll like any other .net dll. This is considered an advanced developer task and you would need to consult the agile.net documentation for further instructions in that process. You would also need to test that the resulting dll can be imported and used in the platform if you are using an external dll project.

        Even is all the previous works, how to you deliver the language files (the fr-fr, de-de etc subfolders) I tried putting the subfolders and resource dlls in the zip file but they are not copied when importing the zip files
        Unfortunately, this would be outside of the scope of the sample that was previously linked. The other sample was not targeted at localization but resource utilization. I would likely need to see if this is currently possible and reply back on that when I have more details.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Unfortunately, this would be outside of the scope of the sample that was previously linked. The other sample was not targeted at localization but resource utilization. I would likely need to see if this is currently possible and reply back on that when I have more details.
          OK thanks, because that's my actual use case. How can we localize indicators using the built-in NT8 localization.

          Comment


            #6
            Just wanted to confirm that yes, after doing the modifications, I can see the html in the exported resource dll, so embedding the default language strings will work. Now question is how to deal with the additional languages
            Last edited by gomifromparis; 02-16-2018, 11:16 AM.

            Comment


              #7
              I was able to embed a resource with strings, but when I use a multi-file resx, for instance MyResource.resx and MyResource.fr.resx, I get only one of them to be merged in the dll resource.

              Comment


                #8
                Hello,

                Thank you for the reply and confirming that for me.

                After further inspection, I do see that the other sample also works for localization you just need to make sure to name the files correctly like they are in the existing NinjaTrader resource files.

                MyResource.fr.resx is not a valid name but MyResource.fr-FR.resx would be. You can see the existing localization .resx files for examples of the correct names.

                Changing the code in the sample from the other page in the .resx file, I can see changes when I change the NT language in the options and restart.

                I did note that only the English is included in a compiled assembly so I will need to research if this would be expected or if the platform should include the separate files in exports as well.

                I look forward to being of further assistance.
                Last edited by NinjaTrader_Jesse; 02-16-2018, 01:34 PM.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  I just wanted to reply back on this item.

                  It would seem that although the compiler does take into account the single .resx file, it will not for multi part resx files. Development suggested avoiding using this type of localization in NinjaScript exports as it is not currently supported. It would instead be advised to use the Language selection in the options to delegate what you can, I understand properties and attributes cannot be controlled in this way.

                  Code:
                  Print(NinjaTrader.Core.Globals.GeneralOptions.Language.ToString());
                  You can also experiment with the sample addon visual studio solution, as that uses visual studio to build the dll you may be able to include multiple resx files in that solution, but that would be outside of what I could further assist with. You can review the sample here: https://ninjatrader.com/support/help...t_overview.htm (Download Visual Studio Solution for AddOn Development).


                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Quite a pity that you designed a localization system that 3rd party developers can't use...

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by RookieTrader, Today, 09:37 AM
                    3 responses
                    15 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by kulwinder73, Today, 10:31 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post kulwinder73  
                    Started by terofs, Yesterday, 04:18 PM
                    1 response
                    23 views
                    0 likes
                    Last Post terofs
                    by terofs
                     
                    Started by CommonWhale, Today, 09:55 AM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by Gerik, Today, 09:40 AM
                    2 responses
                    7 views
                    0 likes
                    Last Post Gerik
                    by Gerik
                     
                    Working...
                    X