Skip to content
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

Translation of country names using Locale::CLDR #205

Closed
2 tasks
bschmalhofer opened this issue Jul 13, 2020 · 12 comments
Closed
2 tasks

Translation of country names using Locale::CLDR #205

bschmalhofer opened this issue Jul 13, 2020 · 12 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bschmalhofer
Copy link
Contributor

bschmalhofer commented Jul 13, 2020

Most Country names are not translated. This means that when adding a customer in a non-english frontend, the country names are still mostly English.

TODO:

  • maybe show two versions, like in Personal Settings, but what about multiligual countries ?
  • maybe add missing Translations

My guess is that these translations can be taken from a publicly available resource.

@bschmalhofer bschmalhofer added the enhancement New feature or request label Jul 13, 2020
@bschmalhofer bschmalhofer added this to the OTOBO 10.1 milestone Jul 13, 2020
@StefanRother-OTOBO
Copy link
Contributor

StefanRother-OTOBO commented Jul 15, 2020

If you look at the country names in the OTOBO -> Personal settings, you can see how it is supposed to be. First the name is displayed in the language of the country (so that the user who speaks the language can recognize it. Behind the minus is then the translation in the currently active language.

Edit: this seems to be about language names, not the country names

@bschmalhofer
Copy link
Contributor Author

The relevant resources for countries in multiple languages seem to be https://cldr.unicode.org/, https://icu.unicode.org/, and https://metacpan.org/pod/Locale::Country::Multilingual.

@bschmalhofer bschmalhofer modified the milestones: OTOBO 10.1, OTOBO 11.0 Feb 23, 2023
@bschmalhofer
Copy link
Contributor Author

As far as I see in rel-11_0 the only place where a country list is used is the AdminCustomerCompany frontend. There there is either a selection of English country names from Locale::Country or from the SysConfig setting ReferenceData::OwnCountryList. The country code isn't used anywhere. However there might be OTOBO packages that enhance the handling of countries.

@bschmalhofer
Copy link
Contributor Author

Finally found the module that has the information from the latest release of CLDR: Locale::CLDR. Looks like it also has everything than anybody ever wanted for localisation.

bschmalhofer added a commit that referenced this issue Nov 11, 2023
Indirect object syntax is just mentioned in the documentation. But
the regular constructor syntax works just as well.
bschmalhofer added a commit that referenced this issue Nov 11, 2023
the list should be stable because Locale::Codes is Kernel/cpan-lib
Testing for the exact result also reduces the number of test cases.
It will also be easier to detect future changes.
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Nov 12, 2023

I verified with OTOBO 10.0.x that the SysConfig setting ReferenceData::OwnCountryList has indeed a strange behavior. The keys of the mapping are simply ignored. Only the values are shown in the GUI and stored in the database.

For the sake of this issue I propose the following:

  • Add new SysConfig setting like ReferenceData::TranslatedCountryNames
  • the new option will be implemented with Locale::CLDR
  • Locale::CLDR will be added to Kernel/cpan-lib
  • The CLDR country code will be stored in the database
  • The country names in AdminCustomerCompany will be in the language of the current user
  • Additionally the Flag, or the Language Code, will be showh
  • In the customer information widgets, the country will be in the language of the current user
  • There is no such concept as selection in the language of the country, because Belgium

@bschmalhofer
Copy link
Contributor Author

Decided against added Locale::CLDR to Kernel/cpan-lib. This is because then the new dependencies of Locale::CLDR would also have to be added to Kernel/cpan-lib. And these modules might interfere with already installed versions of thess modules.

So I declared Locale::CLDR as an optional dependency in the feature div:cldr.
It happens that Locale::CLDR is not available in Linux distro packages. So it has to be installed from CPAN. For convenience div:cldr will be included in the Docker image. This means that the availability of Locale::CLDR has to be checked at runtime. Maybe fall back to Locale::Country.

@bschmalhofer
Copy link
Contributor Author

Worked on the implementation. Found that for each supported language the needed language pack must be installed.

@bschmalhofer
Copy link
Contributor Author

During test I set my language to french. After reloading the page I had in the language selection entries like "Nederlandse - Dutch". The first part is fine, that is Dutch in Dutch. But the second part should be néerlandais, that is Dutch in French. Looks like a translation is missing.

I propose to use Locale::CLDR for the complete matrix.

@bschmalhofer bschmalhofer changed the title Translation of country names Translation of country names using Locale::CLDR Nov 28, 2023
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Dec 1, 2023

Implemented the translation of country names using Locale::CLDR. But my confidence that this is a good solution is waning a bit, as there are some problems:

bschmalhofer added a commit that referenced this issue Dec 2, 2023
Indirect object syntax is just mentioned in the documentation. But
the regular constructor syntax works just as well.
bschmalhofer added a commit that referenced this issue Dec 2, 2023
the list should be stable because Locale::Codes is Kernel/cpan-lib
Testing for the exact result also reduces the number of test cases.
It will also be easier to detect future changes.
bschmalhofer added a commit that referenced this issue Dec 2, 2023
bschmalhofer added a commit that referenced this issue Dec 2, 2023
Also show the flag in the country selection.
Load language packs for the most popular languages
bschmalhofer added a commit that referenced this issue Dec 2, 2023
in the customer information widget of the ticket zoom page
bschmalhofer added a commit that referenced this issue Dec 2, 2023
Thats is, check whether the Locale::CLDR object can be created.
Add code comment about problem with Bouvet Island.
bschmalhofer added a commit that referenced this issue Dec 2, 2023
Indirect object syntax is just mentioned in the documentation. But
the regular constructor syntax works just as well.
bschmalhofer added a commit that referenced this issue Dec 2, 2023
the list should be stable because Locale::Codes is Kernel/cpan-lib
Testing for the exact result also reduces the number of test cases.
It will also be easier to detect future changes.
bschmalhofer added a commit that referenced this issue Dec 2, 2023
bschmalhofer added a commit that referenced this issue Dec 2, 2023
Also show the flag in the country selection.
Load language packs for the most popular languages
bschmalhofer added a commit that referenced this issue Dec 2, 2023
in the customer information widget of the ticket zoom page
bschmalhofer added a commit that referenced this issue Dec 2, 2023
Thats is, check whether the Locale::CLDR object can be created.
Add code comment about problem with Bouvet Island.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
Indirect object syntax is just mentioned in the documentation. But
the regular constructor syntax works just as well.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
the list should be stable because Locale::Codes is Kernel/cpan-lib
Testing for the exact result also reduces the number of test cases.
It will also be easier to detect future changes.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
bschmalhofer added a commit that referenced this issue Dec 9, 2023
Activated with the SysConfig setting ReferenceData::TranslatedCountryNames.
Also show the flag in the country selection.
Load language packs for the most popular languages.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
in the customer information widget of the ticket zoom page
bschmalhofer added a commit that referenced this issue Dec 9, 2023
Thats is, check whether the Locale::CLDR object can be created.
Add code comment about problem with Bouvet Island.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
This version fixed a bug that caused infinite recursion.
bschmalhofer added a commit that referenced this issue Dec 9, 2023
@bschmalhofer
Copy link
Contributor Author

Translations work fine with Locale::CLDR 0.34.4. PR is merged. Closing this issue.

@bschmalhofer
Copy link
Contributor Author

Some missing pieces were encountered:

  • previous country names should still be available, even if they are full country names instead of the two letter codes
  • The special region names Pseudo-Accents and Pseudo-Bidi should not be in the selection
  • The AdminCustomerUser frontend should also show the selection list

@bschmalhofer
Copy link
Contributor Author

Closing again after the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants