Error normalizing taxonomies

41 views
Skip to first unread message

ma.s...@gmail.com

unread,
Apr 2, 2020, 5:49:39 AM4/2/20
to AtoM Users
Hello, I'm using AtoM 2.4.3 and I've been trying to normalize the Places and Locations taxonomies in Catalan culture but I receive an error message like this: A taxonomy named 'X' not found for culture 'ca'.  Theoretically Places should be translated as "Llocs" and Subjects as "Matèries" but I've tried those and some other variants and I keep getting the error shown before. Is there any way to see the taxonomy names used in a particular culture?

Thanks in advance!

Dan Gillean

unread,
Apr 2, 2020, 12:28:30 PM4/2/20
to ICA-AtoM Users
Hi there, 

We can use SQL to output a list of the various taxonomy names in a selected culture. For good measure, I strongly recommend that you make a backup of your database first before you start changing things, just in case! 

Make sure your language is added in the language settings, and you site has been reindexed

If you haven't already done so, then before we proceed make sure that you have navigated to Admin > Settings > i18n languages, added Catalan (or whatever secondary culture you are using), and pressed save. See: 
However, this alone is not enough - we need to make sure that your site has also been reindexed once you add a new language. This is done from the command-line - from AtoM's root installation directory (typically /usr/share/nginx/atom), run: 

Now we should be ready to begin! Let's start by accessing MySQL.

Accessing the MySQL command prompt

To use the query I will provide below, we will first need to access the MySQL command prompt. To do that, we will need to know the MySQL username, password, and database name used during installation. If you can't recall for certain what credentials you used, you can always check in config/config.php - for example, to see this file you could run the following from the root AtoM installation directory, which should be /usr/share/nginx/atom if you have followed our recommended installation instructions: 
  • sudo nano config/config.php
You should see the database name and credentials listed near the top of the file. 

You can also check your database username and password in /root/.my.cnf like so:
  • sudo cat  /root/.my.cnf
Once you have the database name, MySQL user name, and password, we can use these to access the MySQL command prompt. Assuming in the following example that your database name is atom and your user and password are root, you could access the prompt like so: 
  • mysql -u root -proot atom;
Notice that there is a space between the -u and root, but NOT between the -p and the root password. Alternatively, you can leave no password following the -p, and you will be prompted to enter it by the command prompt before proceeding. 

At this point, we should have access to the MySQL command prompt, which should look like this: 

mysql>

Now we can enter our query! 

Show taxonomy names in English and another culture

You can now use the following SQL query to output the taxonomy names in English and Catalan: 
  • SELECT id, culture, name FROM taxonomy_i18n WHERE culture='ca' OR culture='en';
If there no rows in the resulting output with a culture of "ca", then there are currently not any Catalan translations for the taxonomy in question in your database. 

Add a Catalan translation to an existing Taxonomy

We can also use SQL to add a Catalan taxonomy name if one doesn't exist. I will use the Places taxonomy as an example below. First, we need to know the ID of the Places taxonomy, which the results of the previous query can show us - in my output, Places has an ID of 42. I can now add a Catalan name for this taxonomy like so: 
  • INSERT INTO taxonomy_i18n (name, id, culture) VALUEs ('Llocs', '42', 'ca');
If there was already a Catalan taxonomy name translation that was output in the last query, but you wanted to change it, then you could use UPDATE instead: 
  • UPDATE taxonomy_i18n SET name='Llocs' WHERE culture='ca' AND id=42;
Now we should be ready to exit MySQL (just type exit into the MySQL command prompt) and try our taxonomy normalization again! 

Tips for running the taxonomy normalization task

First: you might want to check the default installation culture of your site. You might be entering Catalan data into your site while it is configured to use English as the default culture, for example! In that case, you would actually need to normalize in "en". 

You can check the default culture of your site in apps/qubit/config/settings.yml


If you change the value of the default installation culture, you will need to: 
  • Restart PHP-FPM
    • In Ubuntu 14.04 with PHP5: sudo service php5-fpm restart
    • In Ubuntu 16.04 or 18.04 with PHP7.0: sudo systemctl restart php7.0-fpm
    • In Ubuntu 16.04 or 18.04 with PHP7.2: sudo systemctl restart php7.2-fpm
  • Restart memcached if you are using it
    • In Ubuntu 14.04: sudo service memcached restart
    • In Ubuntu 16.04 or 18.04: sudo systemctl restart memcached
  • Clear the application cache
    • php symfony cc
  • Re-index your site
    • php symfony search:populate
Next: I have fixed this in the upcoming 2.6 documentation branch, but realized that it's not yet fixed in the 2.5 docs example - but, if you are running the taxonomy:normalize task in another culture, then you should provide the taxonomy name in the target culture - so, for our Places taxonomy in Catalan, try the following: 
  • php symfony taxonomy:normalize --culture="ca" "Llocs"
Another thing I remember from earlier versions, that seems to be fixed in 2.5 and later: if you have having issues normalizing in another culture when the taxonomy name includes an accent, try it without the accent: 
  • php symfony taxonomy:normalize --culture="ca" "Matieres"
Hopefully these tips will help - let us know how it goes!

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him


On Thu, Apr 2, 2020 at 5:49 AM <ma.s...@gmail.com> wrote:
Hello, I'm using AtoM 2.4.3 and I've been trying to normalize the Places and Locations taxonomies in Catalan culture but I receive an error message like this: A taxonomy named 'X' not found for culture 'ca'.  Theoretically Places should be translated as "Llocs" and Subjects as "Matèries" but I've tried those and some other variants and I keep getting the error shown before. Is there any way to see the taxonomy names used in a particular culture?

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/6d539ce8-1c4a-4eb3-a62a-ad0a3b11cb00%40googlegroups.com.

ma.s...@gmail.com

unread,
Apr 3, 2020, 6:14:29 AM4/3/20
to AtoM Users
Hello Dan, first of all, thanks for such a detailed answer. Let me explain you my current situation: 

I've got 2 AtoM installations in test servers (versions 2.4.0 and 2.5.3) and 1 in development server (2.4.0 pending to upgrade). In all three of them, catalan is the default culture in apps/qubit/config/settings.yml

I've followed the instructions you provided and in version 2.4 there is no Catalan translation for the taxonomy names. In 2.5.3 already exists. 

So, I've got a couple of questions now:
- If there is no translation for the taxonomy names, do I have to add them myself before normalizing, or do I have to normalize the English ones?
- I only need to normalize Places and Subjects, do I have to add the rest of taxonomy translations? 
- If I add those translations with the INSERT instruction you provided, can it affect the content in any way? (of course, I would make a backup before changing anything)   

Thanks again!
    

El dijous, 2 abril de 2020 18:28:30 UTC+2, Dan Gillean va escriure:
On Thu, Apr 2, 2020 at 5:49 AM <ma....@gmail.com> wrote:
Hello, I'm using AtoM 2.4.3 and I've been trying to normalize the Places and Locations taxonomies in Catalan culture but I receive an error message like this: A taxonomy named 'X' not found for culture 'ca'.  Theoretically Places should be translated as "Llocs" and Subjects as "Matèries" but I've tried those and some other variants and I keep getting the error shown before. Is there any way to see the taxonomy names used in a particular culture?

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-ato...@googlegroups.com.

Dan Gillean

unread,
Apr 3, 2020, 11:43:52 AM4/3/20
to ICA-AtoM Users
Hi again, 

Some responses to your questions below: 


- If there is no translation for the taxonomy names, do I have to add them myself before normalizing, or do I have to normalize the English ones?

If you have created your terms in Catalan, while in the Catalan user interface, then you will need to normalize them in Catalan. Normalizing them with the English language code and taxonomy name will only normalize terms that were created when the user interface is flipped to English. 

Based on what you've told me, it sounds like you've created your terms while the language of the user interface was set to Catalan, so I think to normalize those terms you will need to add a Catalan translation for the taxonomy. 

 
- I only need to normalize Places and Subjects, do I have to add the rest of taxonomy translations?

Nope! In this case you only need to add the translations with this method for the taxonomies you want to normalize. 


 
- If I add those translations with the INSERT instruction you provided, can it affect the content in any way? (of course, I would make a backup before changing anything)  

It shouldn't - and I have asked one of our developers to double-check the SQL query I provided. However, when inserting data directly into a database there is always a risk of something going wrong - so yes, please make sure that you make backups first, that you enter the query exactly, and proceed at your own risk. 

Regards, 
 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him

To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/de902dd7-90d2-411a-bf4a-778adb51556b%40googlegroups.com.

ma.s...@gmail.com

unread,
Apr 7, 2020, 5:52:59 AM4/7/20
to AtoM Users
Hi, after doing some tests, yesterday I tried the solution you gave me and it worked fine. Thank you very much for your help.

Regards.



El divendres, 3 abril de 2020 17:43:52 UTC+2, Dan Gillean va escriure:
Hi again, 

Some responses to your questions below: 


- If there is no translation for the taxonomy names, do I have to add them myself before normalizing, or do I have to normalize the English ones?

If you have created your terms in Catalan, while in the Catalan user interface, then you will need to normalize them in Catalan. Normalizing them with the English language code and taxonomy name will only normalize terms that were created when the user interface is flipped to English. 

Based on what you've told me, it sounds like you've created your terms while the language of the user interface was set to Catalan, so I think to normalize those terms you will need to add a Catalan translation for the taxonomy. 

 
- I only need to normalize Places and Subjects, do I have to add the rest of taxonomy translations?

Nope! In this case you only need to add the translations with this method for the taxonomies you want to normalize. 


 
- If I add those translations with the INSERT instruction you provided, can it affect the content in any way? (of course, I would make a backup before changing anything)  

It shouldn't - and I have asked one of our developers to double-check the SQL query I provided. However, when inserting data directly into a database there is always a risk of something going wrong - so yes, please make sure that you make backups first, that you enter the query exactly, and proceed at your own risk. 

Regards, 
 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him


Reply all
Reply to author
Forward
0 new messages