7 Replies Latest reply: Dec 17, 2009 6:42 PM by Arie Geller RSS

    Conditional Hide/show regions in translated application

    741728
      Hello all,
      I have an issue where I developed a French version of an application using ApEx's in-built translation functionality, all was well (despite a few initial issues) until I added in conditions for user roles. When I have these conditions on each item/region/process etc in ApEx, it works fine in the English version but when I try to view it in the French version, everything is hidden. Am I missing something here? Any form of help is much appreciated.

      Thanks
        • 1. Re: Conditional Hide/show regions in translated application
          Arie Geller
          Hello,

          >> until I added in conditions for user roles …

          You should be more specific. Which conditions are you using? Are they dependent on item values? Other elements that sre language dependent?

          Regards,
          Arie.

          -------------------------------------------------------
          ♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

          ♦ Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More
          • 2. Re: Conditional Hide/show regions in translated application
            741728
            Ah apologies, they are pl/sql functions returning a boolean which checks to see if the corresponding app user has the correct roles and they can be on page items/buttons or regions.

            EDIT: everything in the application is language dependent

            Edited by: user1162552 on 17-Dec-2009 04:05
            • 3. Re: Conditional Hide/show regions in translated application
              Arie Geller
              Hello,

              >> they are pl/sql functions returning a boolean which checks to see if the corresponding app user has the correct roles

              >> EDIT: everything in the application is language dependent

              Better, but still not enough :)

              Can you’ please give us an example of the PL/SQL code you are using?

              If everything in the application, as you said, is language dependent, it’s important to understand the origin of the components you are using for comparison – the user roles. Are you querying them from a table? Are they derived from an APEX component? Why the role is language dependent, are you checking its name, value?

              Regards,
              Arie.

              -------------------------------------------------------
              ♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

              ♦ Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More
              • 4. Re: Conditional Hide/show regions in translated application
                741728
                The actual ID of the role is being passed into the pl/sql function along with the username, this goes and checks to see if the user has such a role in an intersect table between roles and users, if the user does it returns true else returns false.

                I've had issues before when using apex's in-built translation functionality where, after editng a region and republishing the French application so that the change will take affect (since its basically pointing to another application), it still doesn't change the region. In order to rectify this I had to rebuild the entire region from scratch in the English application and then republish. I first thought it was this form of error however, after exporting the application and republishing a new French application, the problem still remained. Almost leads me to believe that its a bug but who knows!

                Thanks for your help :)
                • 5. Re: Conditional Hide/show regions in translated application
                  Arie Geller
                  Hello,

                  Please tell us your first name, and update your forum handle to something more friendly than User123. It’s easier (and nicer) for use to track your threads this way.

                  >> this goes and checks to see if the user has such a role in an intersect table between roles and users …

                  So, in this particular process, I don’t see a language dependent, as the same data is retrieved from the intersect table, regardless of the application language.

                  >> … after editng a region and republishing the French application so that the change will take affect …

                  I don’t know what the term ‘republishing’ includes, when you use it. When you change a region, or any other APEX component for that matter, in the primary language application, you need to go through all the stages of the translation process, starting with seeding the application, even if the change didn’t include any language related actions. The seed process synchronizes the metadata of the primary language application with its translated version, and it’s not just about generating the XLIFF file. If you didn’t make any changes to translatable units, you can use the same XLIFF you already translated and loaded into APEX, but any publishing process must be preceded by an application seed process.

                  >> Almost leads me to believe that its a bug but who knows!

                  I’m working a lot with the APEX translation mechanism, in much more complicated environment than English to French translation, and I can tell you for sure there isn’t any bug which compel you to rebuild APEX component on the primary language application in order for them to be included in the translated application. If you properly seed the primary application, every change you made will be reflected in the translated application, upon publishing it.

                  Regards,
                  Arie.

                  -------------------------------------------------------
                  ♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

                  ♦ Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More
                  • 6. Re: Conditional Hide/show regions in translated application
                    741728
                    Sorry, the name is Steve :)

                    What I meant by republishing was going through the re-translation process and yes it shouldn't make a difference to the code as its based on IDs and not actual strings which could be translated. The function does something along the lines of:

                    ----------------------------------------------------------------------------------------------
                    DECLARE

                    v_username VARCHAR2(4000);
                    v_action number;
                    v_bool BOOLEAN;


                    BEGIN

                    v_action := 108;
                    v_username := :APP_USER;

                    RETURN sec_auth.is_user_privileged(v_username, v_action);

                    END;
                    ----------------------------------------------------------------------------------------------

                    The function it calls basically checks the user and privilege table and pulls back a true or false, this function has been tested and proven that it works since it works in the English version as well as SQL workshop. One thought was that it might of pulled back something like Vrai which is true in French but it shouldn't do this in the first place as the return isn't being translated.

                    Thanks,
                    Steve

                    EDIT:I have also gone through from start to finish the translation process and its still causing this issue.

                    Edited by: user1162552 on 17-Dec-2009 06:26
                    • 7. Re: Conditional Hide/show regions in translated application
                      Arie Geller
                      Hello Steve,

                      >> and yes it shouldn't make a difference to the code as its based on IDs and not actual strings which could be translated

                      And yet, somehow the language do affect the result returned from the function. The next logical step, at least for me, is to check the values the packaged function - sec_auth.is_user_privileged(v_username, v_action) – sees and returned. Unfortunately, the page debug information doesn’t include references to display conditions, so we need to construct our own debug process.

                      I would define 3 application items, two for the function parameters, and one for the returned value. In the packaged function, you can use APEX_UTIL.SET_SESSION_STATE to set the application items with the function parameters. For the returned value, you should amend the conditional PL/SQL function, so that the returned Boolean value will be assigned to the third application item. This change will require re-seed and re-publish of the application.

                      After running the page, in the translated version, you should inspect session state and see if the values of the application items are as expected.

                      Regards,
                      Arie.

                      -------------------------------------------------------
                      ♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

                      ♦ Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More