-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serbian Latin should be the default script for sr #326
Comments
I would go for your first approach and fix it for Plone 6 to get it right in here and keep it for older versions as is. We could add a migration step to fix content (and LanguagRootFolder's) and change |
The information we got from the new webmaster for this site was that nowadays most Serbian written communication is in Latin and not in Cyrillic character. but that's off course N=1. The problem in this case is that there maybe isn't a real preference, they support both. @mauritsvanrees What I missedin in your research as a consideration is supporting the syntax as written in the plone.i18n tests for character set variants, sr@Latn and sr@Cyrl . These should then sill be mapped to sr_Latn and sr_Cyrl folders, like the floating '-' in ab-xy is now mapped to folder ab_xy in plone.app.locales. Without a preference we could do first come first serve alfabetically (which maps nicely sr to sr_Cyrl), or add an extra dict in plone.i18n for character set variants to language code. Then we can patch that dict in our project where I renamed both directories, or update the content to sr@Latn Or is supporting @ opening a few cans of worms in the current Zope i18n code base? |
There does not seem to be anything in the current code that does something with '@'.
We may need to limit the scope of our initial thinking:
So what could we do?
A different approach may be interesting, adding the character set support at the zope level:
Sigh: lots of possibilities, but not yet one clear winner. |
Is there no Serbian developer in the Plone Community who may have an insight on this? |
Wait, how about this:
This requires only one simple change in BTW, with some print statements for debugging, it seems that first the With this approach, dynamically switching between the two character sets in the Plone UI is not possible. But it is technically the same language, so this should be fine. |
The main question for any Serbian users is if you have a multilingual site where you would want to have this. But as it was currently not possible with Plone, I don't think so. the only thing we want to avoid is switchting current Plone websites with Serbian Cyrillic to Serbian Latin when they install a minor/patch update. We can add a line in the rellease notes about the zope_i18n_allowed_languages requirement, I think that suffices. |
sr@Latn and sr@Cyrl will be added to language sr. See collective/plone.app.locales#326
sr@Latn and sr@Cyrl will be added to language sr. See collective/plone.app.locales#326
Where is the standard that defines the @ notation? From my findings its always dash. |
I don't know where the standard is defined, but see for example Serbian Latin translation files in Debian: |
See collective/plone.app.locales#326 Let 'sr' be general Serbian. Can be Latin or Cyrillic. You can influence which character set is used, by choosing one of three values in an environment variable: ``` zope_i18n_allowed_languages sr zope_i18n_allowed_languages sr@Cyrl zope_i18n_allowed_languages sr@Latn ``` Default character set in Plone 5.2 is Cyrillic, but this may change to Latin in 6.0.
See collective/plone.app.locales#326. This is a forward port of #37 from 4.x to master.
Branch: refs/heads/master Date: 2021-09-07T17:12:09+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.i18n@838e2b9 Support Cyrillic and Latin character sets for Serbian. See collective/plone.app.locales#326. This is a forward port of plone/plone.i18n#37 from 4.x to master. Files changed: A news/326.feature M plone/i18n/locales/languages.py Repository: plone.i18n Branch: refs/heads/master Date: 2021-10-14T12:40:18+02:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.i18n@e9589cf Merge pull request #38 from plone/maurits/serbian-master Support Cyrillic and Latin character sets for Serbian. [master] Files changed: A news/326.feature M plone/i18n/locales/languages.py
Branch: refs/heads/4.x Date: 2021-09-07T16:16:18+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.i18n@ed1343a Support Cyrillic and Latin character sets for Serbian. See collective/plone.app.locales#326 Let 'sr' be general Serbian. Can be Latin or Cyrillic. You can influence which character set is used, by choosing one of three values in an environment variable: ``` zope_i18n_allowed_languages sr zope_i18n_allowed_languages sr@Cyrl zope_i18n_allowed_languages sr@Latn ``` Default character set in Plone 5.2 is Cyrillic, but this may change to Latin in 6.0. Files changed: A news/326.feature M plone/i18n/locales/languages.py Repository: plone.i18n Branch: refs/heads/4.x Date: 2021-10-14T12:40:41+02:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.i18n@8cbc721 Merge pull request #37 from plone/maurits/serbian-4x Support Cyrillic and Latin character sets for Serbian. [4.x] Files changed: A news/326.feature M plone/i18n/locales/languages.py
This is done by now. |
See this community thread started in 2017.
This comment from @jensens is a good summary, followed four years later by a comment from my colleague @fredvd who wants me to fix it for a customer.
Problems:
sr
) and Latin (sr_Latn
), but in the language control panel there is no way to choose the latin version. Note: the Cyrillic one is sorted near the bottom of the list as српски (sorting might depend on your locale I guess).So what should be done:
plone.i18n
: in the language list changesr
to mean Serbian Latin, and addsr-cyrl
. Needs to be done separately on branch master and 4.x.plone.app.locales
: rename thesr
folder tosr_Cyrl
and renamesr_Latn
tosr
.I have code ready for this, and I want to push it but first describe the issue.
But now I think: what happens with existing sites that have the 'sr' language?
Say you start out a site in sr, when it still means Cyrillic. And this is the script you want, otherwise you would have done something else, maybe chosen sr-ba (Serbian for Bosnia-Herzegovina) instead.
Then you update to a Plone version where sr means Latin. Suddenly your content is in Cyrillic and your UI in Latin.
So in the language control panel you switch to the new sr-Cyrl and remove sr from the available languages.
Seems to work.
But then you edit the News folder and get a traceback: ConstraintNotSatisfied: ('sr', 'language').
You can go back and allow sr again, so you have two languages, but this is not really what you want.
You now need to write a script to update the language field of all items to sr-Cyrl.
Multilingual is probably worse.
Start with English and sr (Cyrillic) and enable multilingual. Create some content.
Update the code and you again have Cyrillic content end Latin UI.
So you enable sr-Cyrl as extra language.
Now you still have the old sr language root folder with Cyrillic content and Latin UI, and you have a new sr-cyrl folder with Cyrillic UI but no content.
You now need to move all items from sr to sr-Cyrl. And maybe edit some Apache/nginx rewrite rules.
So for the people who do use Serbian Cyrillic currently, the planned changes make things worse and lead to extra work.
What is the alternative?
plone.i18n
: in the language list keepsr
to mean Serbian Cyrillic, and addsr-latn
.plone.app.locales
: actually nothing needs to change.Now what if you wanted a Serbian Latin site and started it with the current code, so without the above changes.
Current status is that you have Cyrillic UI and Latin content. Not ideal.
New status after the alternative, and after switching to the new sr-latn language in the control panel, is that UI and content are Latin, which is good.
Well, you have the same problem that all your current content has the sr language, so you would need a script to update it. And multilingual also has the same problems.
And what if you already did a hack and created a temporary copy of plone.app.locales where you copied sr_Latn to sr? I might know a project where we did this.😉.
Then the first approach above means you can get rid of this temporary copy, which is why Fred asked me to work on this.
The alternative from above would mean extra work: choose the new sr-latn language, and create a script to update the current content to use this language. In our case it is a multilingual site, so it would suffer from the same problems as described above.
In this case we could copy the sr_Latn folder to a locales folder in the buildout of this project, which would mean we can get rid of the temporary plone.app.locales copy.
I guess there are currently sites in the wild which use the 'sr' code so they have Cyrillic UI. Some will have Cyrillic content, some will have Latin content. Whatever we change, someone will not like it, and will need to do some extra work. In both cases, a workaround is to either copy old sr_Latn folder or the new sr_Cyrl folder to a
locales/sr
folder in your buildout, depending on which language you want to use.I suppose the first approach that I describe above would be good, so let 'sr' be Latin.
But since this can be considered a breaking change, it seems better to only do this in Plone 6.
It is one more reason for letting master only target Plone 6 at some point in the near future.
The text was updated successfully, but these errors were encountered: