[CPANEL-31538] ¿Bug? on Locale Export

Operating System & Version
CLOUDLINUX 7.8
cPanel & WHM Version
88.0.10

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
Hi
I'm trying to export the (es_419/en/any-locale) locale but when I try to do through the WHM 'Locale XML Download' says:
Export failed, please try again.

So, when I try to do with the console code (to export in XLIFF) :
Code:
/scripts/locale_export --locale=es_419
And it Returns
Code:
There was a problem with:
    'The system failed to find [numerate,_1,an ,][asis,IPv4] [numerate,_1,address,addresses] for [list_and_quoted,_2]. Because of this, the system cannot find “[_3]”’s authoritative nameservers. See the [asis,cPanel amp() WHM] error log for more details.':
args to quant is weird (src) at /usr/local/cpanel/Cpanel/Locale/Utils/XLIFF.pm line 785.
So, also try with the
Code:
--dumper-format
, so this export to XML, and the exported file isn't translated

i.e.:
Code:
  <item key="(Forbidden)"></item>
When is should says at least:
Code:
  <item key="(Forbidden)">(Prohibido)</item>
Is there any other way to get the proper translation (and translated) file?

Thanks
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
Hello,

I know there is a case open for the locale export which is CPANEL-31538 but for the dumper (legacy version) I wasn't able to replicate this. The first portion is in English but in my download it was all translated starting on this line

Code:
19879      <item key="/usr/local/cpanel/locale/es.yaml">
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
but, this is #31538.
also, I don't know if I make a own XLIFF and load it should work: I was thinking in reading the xml converting by code to XLIFF, translate with poedit and then loading to the locale editor.

Thanks
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
Yes the locale export case ID is CPANEL-31538 for the current version of the locale export XLIFF. The Locale export using the dumper version which is the legacy version XML works from what I was able to see. When you import it you'd need to do so using the locale_import script which can do the conversion for you:

Code:
[[email protected] ~]# /scripts/locale_import --help
/scripts/locale_import [--locale={locale_tag} [--locale=… --locale=… …]] [--import={path} [--import=… --import=… …]] [--quiet] [--no-rebuild]

Import locales in XML format into the Locale database.

Options:
  --help                Show this help screen
  --quiet               Show less output than normal.
  --locale={locale_tag} Specify a locale to import. You can pass the flag multiple times in order to import multiple locales.
      This works on files in paths that `/usr/local/cpanel/scripts/locale_export --locale={locale_tag}` created.
  --import={file}       Specify the path to an XML file that is importable. You can pass the flag multiple times in order to import multiple files.
      This uses files in any arbitrary location and name.
  --no-rebuild          Do not rebuild the locale database after importing the XML file(s).
  --type={import_type}  Specify the import type as "xml" or "xlf" rather than guessing based on the file extension.

You must specify at least one --locale or --import flag.

The XML files that this script works with are created via /usr/local/cpanel/scripts/locale_export.

If nothing was imported the script will exit with an error status. To examine the reasons nothing was imported do not use --quiet
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
I was looking all night long about this...

The main stuck thing is in this line:

Code:
The system failed to find [numerate,_1,an ,][asis,IPv4] [numerate,_1,address,addresses] for [list_and_quoted,_2]. Because of this, the system cannot find “[_3]”’s authoritative nameservers. See the [asis,cPanel amp() WHM] error log for more details.
The part of [numerate,_1,an ,] is weird, because the script for export is expecting to be anything else before the last comma. Something like ',an , some'.

Because this is in *ALL* Locales we can't download the language,

So, I think you should fix at code level.

Thanks.
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
I think there is some confusion here. As I have stated multiple times in this thread this is an issue we are aware of an are resolving, hence the case ID associated with the thread here. This issue is with the XLIFF/Default locale export. We are aware of what the issue is and have already created a fix for it but it is not yet in the product.

The legacy (dumper) version as I have already mentioned multiple times does function using the instructions i provided. If you're able to reproduce an issue with the legacy version please let me know but the issue you're reporting again is for the default version which there is an issue.
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
The Dumper Version doesn't come with translations, so I have to fix manually the code of the export tool, then export the translation and convert it to XLIFF with my code, translate it and re-upload just for fix some missing strings (is a workaround too large just for a small locale fix).

This is a sample of what Dumper Version returns:
Code:
<item key="# of Messages"></item>
As you can see this came empty, so your instructions doesn't works fine.
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
Also, there's other kind of bug...

if I'm importing with this (I'm telling import *this* locale as options says):
Code:
/scripts/locale_import  --locale=i_es_cl --import=/var/cpanel/locale/export/i_es_cl.xlf
but if the XLIFF has this in the code:
Code:
target-language="es_cl"
the import tool will overwrite the parameter 'locale' with the 'target-language'.
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
Hello,

I discussed this at length with the product owner for this feature today. We determined the following:

1. The locale export dumper format does work without issue (as far as functionally) but does not contain all the translations. You could export the XML file update the translations and then import it but poedit would not do this I don't think, because it's an old proprietary syntax.

2. The case in question CPANEL-31538 is actually in test right now meaning it is fixed, we're testing the fix prior to putting it in a version of the product and poedit would recognize the formatting of this so you could translate it.

3. The last issue you note we don't actually believe is a bug but I do have some questions. When you exported and modified the XML file did you modify the target-language parameter prior to importing it? Nothing we saw in the tool led us to believe that the import tool's locale parameter actually did anything besides set the name of the locale you're looking for to import. I believe you need to set the target-language parameter in the XML file itself prior to the import
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
Hi
About point 1, yes poedit doesn't works directly with xml file, I wrote a mini script on PHP that converts to XLIFF and then load it into poedit (then upload, and download for fix some things like <ph> inline.
Really good to listen that about point 2.

About point 3:
When I make a custom locale (from Duplicate Locale), for example one that doesn't exists, I need to create it with the i_ prefix, ie: i_es_CL to use with some custom strings [I prefer translate it first person instead of third person for example]
So, when I download it poedit doesn't recognize as a "translatable locale" then I need to "convert" it to and acceptable locale (es_CL) in that point the file changes the target-language to "es_CL" (but the file should keep exists and being loaded as "i_es_CL").

I know maybe is a weird way to do, but the first time I try it was the only way to create it.

Also, I cannot found where to translate WHM as-it (for example in the ES translation the 'list accounts' is read as 'enumerate accounts').

Thanks!
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston
But when you upload it are you changing the target-language back to i_es_cl? This is what would need to be done it's really just not complex enough to recognize that and change it for you.

Also, I cannot found where to translate WHM as-it (for example in the ES translation the 'list accounts' is read as 'enumerate accounts').
I'm sorry, can you explain this? I don't understand what you're looking for but I do understand that the translation is incorrect.
 

BredeBS

Member
Jun 24, 2020
8
0
1
Chile
cPanel Access Level
Root Administrator
But when you upload it are you changing the target-language back to i_es_cl? This is what would need to be done it's really just not complex enough to recognize that and change it for you.
No, I'm uploading "directly" is supposed that if I use the params to i_es_cl should update that locale and the one by target-language

I'm sorry, can you explain this? I don't understand what you're looking for but I do understand that the translation is incorrect.
I'm looking for the files to edit to translate the WHM as-it (not the cPanel part)
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,271
1,243
313
Houston