1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add-on [PAID] Phrases Search & Replace

Discussion in 'Custom Service/Development Requests' started by Alfa1, Jul 15, 2016.

  1. Alfa1

    Alfa1 Well-Known Member

    I want to have functionality to easily search and replace phrase texts.
    Quite often large addons need a word replaced, which means I manually have to edit thousands of phrases which is madness. I'd like to have an addon that simply replaces all instances of word X for Y.
     
    we_are_borg and Luis like this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    Export untranslated phrases from a language for the add on to an XML and then use find and replace in a decent text editor to replace all occurrences easily.

    Then import that. Still a bit of manual effort required but much easier than using the ACP.
     
    HWS and Alfa1 like this.
  3. Alfa1

    Alfa1 Well-Known Member

    I just want to have a search and replace field in admincp.
     
    cdub likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Sure, but there's an alternative I thought was worth mentioning that's fairly effective.
     
    viper357 and Alfa1 like this.
  5. Alfa1

    Alfa1 Well-Known Member

    I appreciate your helpful feedback in many threads. I just feel that this is something that is really missing in XF and therefore I want to have the functionality created.
     
  6. Alfa1

    Alfa1 Well-Known Member

    The problem arises when you try to rename the main phrases of the addon, as its likely that the phrase names also include the same words. A search and replace will then wreck the phrase titles.
     
  7. EQnoble

    EQnoble Well-Known Member

    Not to argue but that is simply not true, all data associated with the phrase that actually get's displayed on the front end is nicely contained within <![CDATA[ PHRASE DATA HERE ]]> so you can use a signature and regex to match everything.

    Untitled.png
     
  8. Alfa1

    Alfa1 Well-Known Member

    Maybe its not true for developers, but I have no clue what you are saying. Its not simple I am afraid. I don't understand regex and I dont think xenforo customers should be expected to do so.
    I did a search and replace as suggested and wrecked my language file. Phrase names and other non-phrases code has been changed. So the only way that I know to resolve it, is to either reinstall my addons or to import new language files. (not sure where to get these)

    Its such a mess and all that to simply replace one word.
     
    viper357 likes this.
  9. EQnoble

    EQnoble Well-Known Member

    Well what I am saying is that my example shows why simple search and replace wont work either, you have the words "month" and "months" in phrases, a simple search for "month" will also match the word "months" but ignore the 's' after it which means when month get's replaced the s will be after whatever word you replaced month with whether or not it is intended or relevant.

    This is just one unintentional example that appears within the one screenshot I posted as an example but I'm sure if I went through the other 6533 phrases that I could find more issues that would make simple text replacement useless and tedious or at the very least cause you some different problems without really solving anything.

    The only way you can really edit things en masse and fast is with proper regex or one at a time manually otherwise you or someone else will have errors, this is not a xenforo problem but is an issue related to general data manipulation and what systems are available to do those actions.

    The whole reason things like regex exist is to make a more exacting search possible, without it you will never get around issues like the one I made an example of and is probably the reason it has been used for matching patterns in text editors since 1968.

    Ultimately the only way around this is to create a tool that can do regex-like matching without a user needing to know regex unless someone knows something I don't about pattern matching. The unfortunate part about this is for years people have been trying to make tools that do nothing but create regex for people who don't know it and most of those tools fail...hard.

    I'm not saying what you are asking for is unreasonable (especially if you don't know regex) I am just saying that to make it where the requirements are a user can search phrases for exact matches and patterns without knowing regex and replace them without error or different forms of cleanup you would be asking for quite a comprehensive job compared to the appearance of simplicity of the job.

    If they come up with something useful to handle this, kudos...I just am trying to fill you in on my view of the technicalities from the perspective of someone that uses regex everyday on the web, in compiled languages and on my desktop.
     
  10. Alfa1

    Alfa1 Well-Known Member

    To replace an exact word, it needs to replace only text that has a space before and after it. This will prevent unintended replacements. And the search and replace should only affect phrase texts and nothing else.

    It would be a rather simple addon that resolves a load of headache.
     
  11. EQnoble

    EQnoble Well-Known Member

    Hey it's your world, I just don't think it's worth all the effort only to match exact words but if you can find the dev to do it, it's your money boss.
     
  12. Alfa1

    Alfa1 Well-Known Member

    Its not a single use thing. Its something encountered again and again. By many.
     
  13. EQnoble

    EQnoble Well-Known Member

    I'm not arguing that at all, just saying it's not terribly useful when some phrases are not just pure text and have comma's or periods after words (no space by your definition to break the word) and some have html and things like <a {link_params}>.

    If someone does it for you that's great, I am just saying from the other side of things that only replacing #word# has many shortcomings.
     
  14. Alfa1

    Alfa1 Well-Known Member

    I have manually replaced many hundreds of phrases in various addons over the years and have never encountered a html phrase that needed replacement, so I am not worried about that at all.

    A comma, period or colon after a word is indeed something to include, as long as these are followed by a space.
     
  15. Chris D

    Chris D XenForo Developer Staff Member

    Alfa1 likes this.
  16. Luis

    Luis Well-Known Member

    Personally I will support this suggestion @Alfa1 , whether or not it is not a good idea. The translation system is outdated, obsolete, lacking features, etc.

    With the same idea leaneth any suggestions from anyone about translations.
     
    tajhay, Alfa1, Claudio and 1 other person like this.
  17. Luis

    Luis Well-Known Member

    @Alfa1 , please apologies for my comment/post in this thread. I thought this topic was in the forum suggestions.
     
    Alfa1 likes this.
  18. DroidOne

    DroidOne Well-Known Member

    I would argue that there really is no "translation system" at all. There is a basic phrasing system, which is good enough if you'd like to edit a phrase or two.

    ...but for translation of the whole software? Or even add-ons? It's a nightmare. Many have tried, and many have failed. It's cumbersome and almost impossible to make into a group effort, people from different communities can't come together and do it as a team.

    I'd support any effort to add some sort of ability to export/import to/from Crowdin. It would make Xenforo much better suited for non English communities.

    Also, many of the language files on here are outdated. How many are up to date with XF 1.5.x? Maybe 10-15? How many support the media gallery? Maybe a couple? Resource manager? Maybe 1? There's reason for that.

    I've made a translation to Swedish, 100%, for XF 1.5.x (the one available here is for 1.4.3, and doesn't support the media gallery). I've also translated a bunch of big add-ons. I can't share any of it though.

    Why? Because I didn't see the point in creating a "general translation" for XF+add-ons for others to use as a base, as it would require tons of extra work with the way things are, not to mention having to maintain the resource here on XF. Simply not practical.

    I think that the same applies for a lot of folks out there running communities in other languages. It's a real shame, and from what I've read from the staff here, the interest in fixing it seems next to non-existent :( I'm still hoping for XF 2.0 making things at least a tiny bit more practical though ;)
     
    Last edited: Jul 18, 2016
    Vitor Dos Reis, Xon and Alfa1 like this.
  19. Alfa1

    Alfa1 Well-Known Member

    The development of this addon is underway.

    It will have functionality to search and replace words in phrase texts of specific addons.
    It will only affect whole words and not replace partial words.
    It will also affect words followed by comma, period and colon.
     
    Luis and DroidOne like this.
  20. Alfa1

    Alfa1 Well-Known Member

    This project has been completed.

    The addon allows me to quickly search and replace specific words in phrase texts of specific addons in specific languages.
    It takes a few seconds to accurately replace hundreds of instances of the same word.

    For example change 100's of instances of 'resource' and 'resources' into 'download' and downloads' in just a few seconds.
     
    Vitor Dos Reis, Luis and DroidOne like this.

Share This Page