• Resolved Rick Curran

    (@rickcurran)


    Hi,
    I developed a site 2 or 3 years ago with a custom theme and used the Loco translate plugin to handle the translations. I am currently working on a redevelopment of it and I am encountering an issue with the ordering of the strings in the POT file being generated.

    Previously when I developed the site 2 or 3 years ago the POT file had all the strings in order that followed the template files and respective line numbers in these files, so it kept all of the strings together in context.

    However, I have generated a new POT file using the latest version of the plugin (2.5.1 at the time of writing) as part of the redevelopment and now all of the strings in the POT file are ordered alphabetically instead which makes it much harder for the translators to understand the context of various strings.

    Is there a setting somewhere that is changed that is affecting this? Or something else that I’m missing (or misunderstanding!).

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tim W

    (@timwhitlock)

    There is no setting to control the order of strings in POT files.

    It looks like sorting of extracted strings was added in 2.1.0 (3 years ago) I don’t recall specifically why it was added, but it would have been as an improvement. This is the first time I’ve ever been asked to keep the order as per files on disk. Context is easily added using extractable comments and the actual context field if needed for strong disambiguation.

    I could potentially add a filter or an option to control sorting behaviour, but right now to remove the sorting functionality you will have to modify the code here to pass false to the msgcat method.

    Thread Starter Rick Curran

    (@rickcurran)

    Thanks @timwhitlock, I’ve modified that code for now and that has let me go back to the previous ordering method based on the order they appear in the templates.

    It would be useful to have some form of filter or control for that sorting to save having to change it in future plugin updates, I don’t usually generate PO files that often but with the current development schedule of a project I’m working on it is likely to be a recurring process.

    Thanks again for your prompt help!

    • This reply was modified 3 years, 8 months ago by Rick Curran. Reason: Minor Clarification
    Plugin Author Tim W

    (@timwhitlock)

    If you have an on-going project with regular string changes, I’d recommend using command line xgettext to do a POT build on every code commit. A bit of hassle to set up, but you’ve never ship a POT that’s not in sync with the code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Order of strings in POT file’ is closed to new replies.