• Login
Community
  • Login

How to replace all numbered ID with a list of name in different languages

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 478 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    Farhan Syabibi
    last edited by Sep 1, 2024, 12:47 AM

    So i have a master txt file that contain some keyword of an item ID, for example

    ID0001
    ID0002
    ID0003

    Then i want to make a copy of that and replace all IDxxxx into a name that match the ID but in different languages, like:

    ID0001, Bicycle, Fahrrad, Bicicletta

    So essentially replace id0001 into bicycle in different languages, but just one language for one copy of the files

    M T 3 Replies Last reply Sep 1, 2024, 4:28 AM Reply Quote 0
    • M
      Mark Olson @Farhan Syabibi
      last edited by Sep 1, 2024, 4:28 AM

      @Farhan-Syabibi
      This is a job for a scripting language like Python or PowerShell . If you need help writing scripts in a scripting language, this is the wrong place to ask questions.

      Somebody else might chime in with a way to use Notepad++ builtin functionality or plugins to solve your problem, but IMO that is much less efficient than just using a scripting language.

      1 Reply Last reply Reply Quote 2
      • T
        Thomas Knoefel @Farhan Syabibi
        last edited by Thomas Knoefel Sep 1, 2024, 9:37 AM Sep 1, 2024, 9:36 AM

        @Farhan-Syabibi
        You can achieve this with the MultiReplace Plugin, but for simplicity, I recommend splitting the replacement tasks into different languages.

        To do this, create a replacement list in the MultiReplace Plugin that looks like this:
        9c0e972c-ebe1-4943-852e-0ecc0f06980f-image.png

        You can also generate the Replacement list as it is stored in CSV format.

        1 Reply Last reply Reply Quote 1
        • T
          Thomas Knoefel @Farhan Syabibi
          last edited by Thomas Knoefel Sep 1, 2024, 11:09 AM Sep 1, 2024, 10:34 AM

          @Farhan-Syabibi

          I gave a more advanced version with MultiReplace a go. But try version of the previous post first.

          Enable ‘Use Variables’ before adding each line into the list.

          By changing the number for LANG in the init part from 1 to 3, you can switch between the language replacements. Just right click on the entry and choose 'Edit Field ’ in the Context menu.

          But I have to mention. It is necessary to combine the init command with a single match that appears first in the document; otherwise, the init will not be triggered and the following lines are failing. Or you put the init into each line.

          So list look finally like this:
          5669c085-8004-4e4a-bf02-cbfc5a0b7ffe-image.png

          Simply copy-paste this raw data into the replacement list, for testing:

          1,"ID0001","init({LANG=3});set((({""Bicycle"", ""Fahrrad"", ""Bicicletta""})[LANG]) );",0,0,1,0,0
          1,"ID0002","set(({""Mountain Bike"", ""Mountainbike"", ""Bicicletta da montagna""})[LANG]);",0,0,1,0,0
          1,"ID0003","set(({""Airplane"", ""Flugzeug"", ""Aeroplano""})[LANG]);",0,0,1,0,0
          
          F 1 Reply Last reply Sep 1, 2024, 10:08 PM Reply Quote 1
          • F
            Farhan Syabibi @Thomas Knoefel
            last edited by Sep 1, 2024, 10:08 PM

            @Thomas-Knoefel
            I see, thanks i will try that later

            1 Reply Last reply Reply Quote 0
            4 out of 5
            • First post
              4/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors