Jump to content

Upgrading custom language


Sonya*

Recommended Posts

I have some non-English projects, where I have made some changes to the language strings. These changes should be permanent. There is also a language pack in Marketplace. When I upgrade the project, I have to make many steps to keep my custom translations. This is how I do it:

  1. Download the custom language as XML (Custom package)
  2. Download Marketplace package as XML (Marketplace package)
  3. Copy Marketplace package (Merged package)
  4. Upload a new version (Custom package) on Merged package
  5. Change the name of the package back to Merged
  6. Set Merged package as Default
  7. Disable other language packages

When I'd like to change some strings in my project, I have to go this way

  1. Make changes in my Custom package
  2. Download Custom package as XML
  3. Upload a new version (Custom package) on Merged package
  4. Change the name of the package back to Merged

When there is an upgrade for Marketplace package:

  1. Upgrade Marketplace package
  2. Download Marketplace package as XML (Marketplace package)
  3. Upload a new version (Marketplace package) on Merged package
  4. Upload a new version (Custom package) on Merged package
  5. Change the name of the package back to Merged

This is quite time-consuming. I wish parent/child construction (like themes), where my custom changes just overload the Marketplace package. Additionally, a filter where I can see what translations differ from parent version. This would help to prevent all these steps above, keep my custom translations and still use Marketplace updates without loosing my custom changes.

Link to comment
Share on other sites

9 minutes ago, CoffeeCake said:

Just a note that this helps with fully English projects as well. We often use different phrases and words for built in features and use the translation/language tool to maintain this.

Yes, the best example are Clubs. Some communities keep Clubs, others want Groups, there are also Guilds or Teams. Changing those strings makes you actually non-upgradable. All new strings go to default language, and you have to update your custom language somehow manually.

Edited by Sonya*
Link to comment
Share on other sites

Just now, Daniel F said:

Have you tried creating a plugin to replace every langstring  containing clubs with e.g. guilds just before the strings are returned?

No. This was just an example for English usage. 🙂 For my case, I need something to upgrade my Russian and German projects more efficiently 😉 

Link to comment
Share on other sites

There's a similar suggestion topic and once again.. we're aware of many issues and limitations with the current language system, but it's just a too huge change and I don't expect that we'll start such a reactoring while the IPS 4.x lifecycle.

That said=>

36 minutes ago, Sonya* said:

I need something to upgrade my Russian and German projects more efficiently 😉 

That's exactly what I'm talking about:)
A hook on Lang::replaceWords with something like

array_walk_recursive($this->words, function(&$i,$key) use ( $searchAndReplace ) {
$i = strtr( $i, $searchAndReplace );
});

will do literally all the work for you;)

Unfortunatly I'm lacking the time to create a proper MP compatible app for this, but it's really not that hard.

A database table + node model + controller to manage the replacements, store them to the Datastore to save the global query, run replacement at the end, BOOM DONE!

 

Bildschirmfoto 2021-04-05 um 19.13.34.png

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...