Loading ...
Sorry, an error occurred while loading the content.

Cross-platform multi-lingual support and Windows

Expand Messages
  • ron
    Hi all. I m trying to add a language menu to my vim setup so my users can select a UI language. The scripts work great on Linux, and I finally managed to
    Message 1 of 10 , Apr 8 12:46 AM
    • 0 Attachment
      Hi all.

      I'm trying to add a 'language' menu to my vim setup so my users can
      select a UI language. The scripts work great on Linux, and I finally
      managed to get them working properly (mostly) on Windows XP. However,
      Windows 7 is puzzling me.

      I can get the menus to appear, but the messages never appear in the
      correct language. Again, this works fine for me on Linux and XP.

      The relevant scripts are here: http://ronware.org/lang.zip

      Is there any way vimscript can distinguish windows versions?

      Any help appreciated...

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      To unsubscribe, reply using "remove me" as the subject.
    • Tony Mechelynck
      ... In brad terms, yes; but not necessarily with the precision you want. has( win16 ) is nonzero (TRUE) in w3, w3.1, w3.11, with or without w32s; all obsolete
      Message 2 of 10 , Apr 8 1:41 AM
      • 0 Attachment
        On 08/04/10 09:46, ron wrote:
        > Hi all.
        >
        > I'm trying to add a 'language' menu to my vim setup so my users can
        > select a UI language. The scripts work great on Linux, and I finally
        > managed to get them working properly (mostly) on Windows XP. However,
        > Windows 7 is puzzling me.
        >
        > I can get the menus to appear, but the messages never appear in the
        > correct language. Again, this works fine for me on Linux and XP.
        >
        > The relevant scripts are here: http://ronware.org/lang.zip
        >
        > Is there any way vimscript can distinguish windows versions?
        >
        > Any help appreciated...
        >

        In brad terms, yes; but not necessarily with the precision you want.

        has('win16') is nonzero (TRUE) in w3, w3.1, w3.11, with or without w32s;
        all obsolete by now

        has('dos16') and has('dos32') are TRUE in versions of Vim compiled to
        run with 16- or 32-bit code, respectively, on DOS systems (with DJGPP
        for 32 bit); some such versions may still be running on Windows.

        has('win32') is TRUE in any 32-Vim for Windows; of these, versions for
        w95/w98/wME also have has('win95') TRUE. This item also applies to
        32-bit Vim running on 64-bit Windows IIUC.

        has('win64') is TRUE in Vim versions compiled for 64-bit Windows (such
        an executable will of course not be able to run unless it has both a
        64-bit processor and a 64-bit OS). This was added by patch 7.2.328 which
        is relatively recent; before that, there was no way for a script to know
        that you had a 64-bit version of Vim.

        has('gui_win32') is TRUE in gvim for w32 (and presumably for w64) but
        not in console versions. On Windows, unlike on Unix, a single executable
        can be either a GUI or a console application but not both.

        see
        :help has()
        :help feature-list

        To test if you have patch 7.2.328 compiled-in (cf. :help has-patch):

        if (version > 702) || (version == 702 && has('patch328'))
        echo "7.2.328 or better"
        if has('win64')
        echo "64-bit Vim"
        elseif has('win32')
        echo "32-bit, NOT 64-bit Vim"
        else
        echo "Neither Win32 nor Win64: Cygwin? Unix? Dos?"
        endif
        else
        echo "not yet 7.2.328"
        if has('win32')
        echo "Windows Vim, don't know if 64-bit"
        else
        echo "Neither Win32 nor Win64: Cygwin? Unix? Dos?"
        endif
        endif

        I'm intentionally testing |version| rather than |v:version| (q.v.) so
        that even very old Vim versions will still react correctly (by returning
        a version value much lower than 702).


        Best regards,
        Tony.
        --
        After an instrument has been assembled, extra components will be found
        on the bench.

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        To unsubscribe, reply using "remove me" as the subject.
      • ron
        On Apr 8, 11:41 am, Tony Mechelynck ... Thanks, I know that ... It turns out it was Programmer Error (on my part). My NSIS
        Message 3 of 10 , Apr 8 3:53 AM
        • 0 Attachment
          On Apr 8, 11:41 am, Tony Mechelynck <antoine.mechely...@...>
          wrote:

          >         :help has()
          >         :help feature-list

          Thanks, I know that ...

          It turns out it was Programmer Error (on my part). My NSIS installer
          was not running with high enough privileges to set VIMRUNTIME in the
          environment. By the way, requiring that to be set is really odd ...
          but anyway, my stuff now works on Vista and Windows7

          Thanks again,
          Ron

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          To unsubscribe, reply using "remove me" as the subject.
        • Tony Mechelynck
          ... You should not need to set VIMRUNTIME in the permanent environment; on Windows, Vim sets it (for itself and the processes it spawns, but not permanently),
          Message 4 of 10 , Apr 8 4:11 AM
          • 0 Attachment
            On 08/04/10 12:53, ron wrote:
            > On Apr 8, 11:41 am, Tony Mechelynck<antoine.mechely...@...>
            > wrote:
            >
            >> :help has()
            >> :help feature-list
            >
            > Thanks, I know that ...
            >
            > It turns out it was Programmer Error (on my part). My NSIS installer
            > was not running with high enough privileges to set VIMRUNTIME in the
            > environment. By the way, requiring that to be set is really odd ...
            > but anyway, my stuff now works on Vista and Windows7
            >
            > Thanks again,
            > Ron
            >

            You should not need to set VIMRUNTIME in the permanent environment; on
            Windows, Vim sets it (for itself and the processes it spawns, but not
            permanently), usually to the directory from which it was loaded
            ("C:\Program Files\vim\vim72" or similar). In addition, that setting
            changes from one version to the next so it really should _not_ be
            permanent (if you run two different Vims in parallel, each of them
            should set VIMRUNTIME in its own environment according to its version).

            Similarly Vim sets VIM, usually to the parent of VIMRUNTIME. You may
            want to set it if you want to access, let's say, $VIM/vimfiles from the
            command (shell) prompt, but it is not necessary.


            ...and if you mean that setting variables temporarily in one's own
            environment requires superuser privileges on Windows Vista and later,
            that's one more proof (if I needed any) that Gates & Co. don't
            understand a thing to what security means: such a measure won't make
            fewer users set environment variables, it will make more of them grab
            superuser privs permanently, which is the opposite of the desired result.


            Best regards,
            Tony.
            --
            The men sat sipping their tea in silence. After a while the
            klutz said, "Life is like a bowl of sour cream."

            "Like a bowl of sour cream?" asked the other. "Why?"

            "How should I know? What am I, a philosopher?"

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            To unsubscribe, reply using "remove me" as the subject.
          • ron
            On Apr 8, 2:11 pm, Tony Mechelynck ... I don t install in the usual manner, but rather have a e.g. c: vim directory where
            Message 5 of 10 , Apr 8 4:33 AM
            • 0 Attachment
              On Apr 8, 2:11 pm, Tony Mechelynck <antoine.mechely...@...>
              wrote:
              > You should not need to set VIMRUNTIME in the permanent environment; on

              I don't install in the 'usual' manner, but rather have a e.g. 'c:\vim
              \'
              directory where the executable is in 'c:\vim\bin' and the runtime is
              in
              'c:\vim\runtime'. My special runtime files are in 'c:\vim\global'.
              Don't
              ask, it's to support various needs of different people.

              Anyway, vim has never been happy with my layout. I do set VIMRUNTIME
              in the
              _vimrc file -- however, it needs to be set *before* _vimrc is sourced,
              because
              ... well, I suppose the gettext initialization happens early so that
              any
              messages appear correctly.

              In any case, it's not too onerous to set it in the environment, but...
              it
              makes installation a bit more fragile than it could be. BTW, I do
              also set
              VIM to e.g. 'c:\vim\bin'.

              > ...that's one more proof (if I needed any) that Gates & Co. don't
              > understand a thing to what security means

              No argument from me. I use Linux almost exclusively... but I support
              users on
              a variety of Windows flavors, and I need to be able to deploy nicely
              on them.

              Best,
              Ron

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              To unsubscribe, reply using "remove me" as the subject.
            • ron
              Here s a question for Bram, probably: In main.c , around line 382, there is an init_locale() which is intended to happen after gui_init_check() . However,
              Message 6 of 10 , Apr 9 7:02 AM
              • 0 Attachment
                Here's a question for Bram, probably:

                In 'main.c', around line 382, there is an 'init_locale()' which is
                intended to happen after 'gui_init_check()'.

                However, this only happens for the GTK UI. My question is, would it
                cause a problem to move this outside of that conditional and enable it
                for all versions of vim (not just GUI version).

                I ask, because I modify $VIMRUNTIME in my startup scripts, early,
                before the UI starts up. If the 'init_locale()' was re-done after my
                vimrc had been processed, then I would not need to have VIMRUNTIME set
                (on Windows boxen) in order to have the gettext stuff work correctly.

                Thanks,
                Ron

                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                To unsubscribe, reply using "remove me" as the subject.
              • Bram Moolenaar
                ... What version of NSIS are you using? Later versions have support for Windows7. We should detect that the installer is running with wrong privileges. Can
                Message 7 of 10 , Apr 9 12:42 PM
                • 0 Attachment
                  Ron Aaron wrote:

                  > On Apr 8, 11:41 am, Tony Mechelynck <antoine.mechely...@...>
                  > wrote:
                  >
                  > > :help has()
                  > > :help feature-list
                  >
                  > Thanks, I know that ...
                  >
                  > It turns out it was Programmer Error (on my part). My NSIS installer
                  > was not running with high enough privileges to set VIMRUNTIME in the
                  > environment. By the way, requiring that to be set is really odd ...
                  > but anyway, my stuff now works on Vista and Windows7

                  What version of NSIS are you using? Later versions have support for
                  Windows7.

                  We should detect that the installer is running with wrong privileges.
                  Can that be done?

                  --
                  We apologise again for the fault in the subtitles. Those responsible for
                  sacking the people who have just been sacked have been sacked.
                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ download, build and distribute -- http://www.A-A-P.org ///
                  \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  To unsubscribe, reply using "remove me" as the subject.
                • Bram Moolenaar
                  ... Perhaps the best solution is to put the code that uses $VIMRUNTIME to another function and only call that part again after sourcing the vimrc file. I don t
                  Message 8 of 10 , Apr 9 12:42 PM
                  • 0 Attachment
                    Ron Aaron wrote:

                    > Here's a question for Bram, probably:
                    >
                    > In 'main.c', around line 382, there is an 'init_locale()' which is
                    > intended to happen after 'gui_init_check()'.
                    >
                    > However, this only happens for the GTK UI. My question is, would it
                    > cause a problem to move this outside of that conditional and enable it
                    > for all versions of vim (not just GUI version).
                    >
                    > I ask, because I modify $VIMRUNTIME in my startup scripts, early,
                    > before the UI starts up. If the 'init_locale()' was re-done after my
                    > vimrc had been processed, then I would not need to have VIMRUNTIME set
                    > (on Windows boxen) in order to have the gettext stuff work correctly.

                    Perhaps the best solution is to put the code that uses $VIMRUNTIME to
                    another function and only call that part again after sourcing the vimrc
                    file.

                    I don't know how much overhead this has on different systems. Only
                    calling bindtextdomain() again if $VIMRUNTIME has changed requires
                    keeping the value used the first time. Or detecting that it's changed.

                    --
                    Mynd you, m00se bites Kan be pretty nasti ...
                    "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                    \\\ download, build and distribute -- http://www.A-A-P.org ///
                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                    --
                    You received this message from the "vim_dev" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php

                    To unsubscribe, reply using "remove me" as the subject.
                  • ron
                    I *think* it s not a big hit, but vim does run on a *lot* of different systems. Maybe it would be ok to just add it for WIN32 systems? ... -- You received
                    Message 9 of 10 , Apr 10 12:44 PM
                    • 0 Attachment
                      I *think* it's not a big hit, but vim does run on a *lot* of different
                      systems. Maybe it would be ok to just add it for WIN32 systems?


                      > I don't know how much overhead this has on different systems.  Only
                      > calling bindtextdomain() again if $VIMRUNTIME has changed requires
                      > keeping the value used the first time.  Or detecting that it's changed.

                      --
                      You received this message from the "vim_dev" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php

                      To unsubscribe, reply using "remove me" as the subject.
                    • ron
                      I m running the latest NSIS. I simply had to put the right line in my .nsi file, to wit: RequestExecutionLevel highest ... -- You received this message
                      Message 10 of 10 , Apr 10 12:45 PM
                      • 0 Attachment
                        I'm running the latest NSIS. I simply had to put the right line in
                        my .nsi file, to wit: "RequestExecutionLevel highest"


                        > What version of NSIS are you using?  Later versions have support for
                        > Windows7.
                        >
                        > We should detect that the installer is running with wrong privileges.
                        > Can that be done?

                        --
                        You received this message from the "vim_dev" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php

                        To unsubscribe, reply using "remove me" as the subject.
                      Your message has been successfully submitted and would be delivered to recipients shortly.