Jump to content

Multi-language behavior in modules (special case when using external json data files)


Recommended Posts

Posted

Not "exactly", as I added a slug/url field your proposed solution ? 
So we are thinking the same, and we should add a request for this, but it is a breaking change to the core. Not sure if Ryan is willing to do this. Or he/we finds a way to be backwards compatible, where the language name is different than the ISO code.

The PR that @LostKobrakai provided is a bit different to this behaviour, as it would require users to import the translations by hand.

The new solution could load the translations automatically, as the language code is predefined.

  • Like 1
Posted

First of all ISO 3166 is for countries, not languages – there are countries like switzerland, which has 4 official languages. ISO 639 is what we would need. But ProcessWire doesn't care about that. You could be needing Globish, which doesn't have an iso code. So the iso code should always be optional anyways. This difficulty is exactly why I made my PR not rely on an automatic mapping, but simply let users decide which translation to import into which language of the system. Once processwire might add an field for iso codes to the languages template it's an easy addition to detect matching codes and suggest imports to the user automatically.

  • Like 1
Posted
11 minutes ago, LostKobrakai said:

First of all ISO 3166 is for countries, not languages – there are countries like switzerland, which has 4 official languages. ISO 639 is what we would need. 

You're right, of course!

  • Like 1
Posted
9 minutes ago, LostKobrakai said:

You could be needing Globish, which doesn't have an iso code. So the iso code should always be optional anyways.

The workflow could be like this: Add new language -> List of predefined languages with ISO code is provided, and a "Language not in this list? Add a custom language" option.

So modules could use automatic translations for all predefined languages and for the custom language you could import the language file by hand.

Posted
38 minutes ago, Jens Martsch - dotnetic said:

The workflow could be like this: Add new language -> List of predefined languages with ISO code is provided, and a "Language not in this list? Add a custom language" option.

The downside would be the need to ship a list of languages/iso codes with the processwire core. I guess with weekly releases it's not to much of a pain though to require a fresh release once there's a change in that list.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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