Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Translating 2.1.16 CP: untranslated strings #1068

Closed
ebeauchamps opened this issue Oct 26, 2016 · 16 comments
Closed

Translating 2.1.16 CP: untranslated strings #1068

ebeauchamps opened this issue Oct 26, 2016 · 16 comments

Comments

@ebeauchamps
Copy link

ebeauchamps commented Oct 26, 2016

In reference to #293 which was was and still is an exhaustive analysis of the CP

  1. Many basic strings of the CP (no javascript ones) still don't appear as being translated.
    Just as an example:
    • "Search for anything..."
    • most strings located on the Assets page
      capture d ecran 2016-10-26 a 23 06 21
  2. One new string introduced with 2.1.16 isn't even translatable
    • "Algolia Searchable Attributes" in Settings/Search
@jasonvarga
Copy link
Member

Aside from the new Algolia Searchable Attributes translation, which we missed in the latest release, the rest are all translatable. I think you probably just don't have the keys.

Excuse my horrible placeholder translations (hopefully not offensive...)

image

I put this in site/lang/fr/cp.php

<?php

return [
    'search_for_anything' => 'le search for anything',
    'delete' => 'le delete',
    'new_folder' => 'le new folder',
    'upload_asset' => 'le upload asset',
    'sync_assets' => 'le sync assets',
    'title' => 'le title',
    'filename' => 'le filename',
    'filesize' => 'le file size',
    'date_modified' => 'le date modified',
    'search' => 'le search',
    'view_site' => 'le view site'
];

@ebeauchamps
Copy link
Author

Hi Jason.

Again, as I am saying it since Beta, 99,99% of the keys already are in the files located in site/lang/fr/ because those keys already are in your own Statamic files located in en

The problem is that Statamic cannot accessed those keys!!
"Search for anything..." has been added to the en language file months ago, therefore to my French files, but still it doesn't translate. I made numerous posts and mails on this. But I understand that you had higher priorities then.

Just ask Gauran to create the Spanish translation and he will be surprised.

Then, If there are missing keys in your own Statamic en files, THAT is a really big problem because there is absolutely NO WAY we can detect the key: we only can detect the label of it in the CP.

Take care.

@jasonvarga
Copy link
Member

I'm sorry, I'm really not following. What do you mean by this?

Statamic cannot accessed those keys!!

In my previous reply, I added the keys to a French translation file and it successfully translated them.

Apart from the new "Algolia Searchable Attributes" string, what is missing, and where are you looking?

@ebeauchamps
Copy link
Author

ebeauchamps commented Oct 27, 2016

Hi again Jason.
Sorry for being dense.
Let's take a simple example:

in statamic/resources/lang/en/cp.php I can find this:
'search_for_anything' => 'Search for anything',

If I delete any French folder located on my install, I get a CP that is displayed in English and at the Top I can see:
Search for anything...
OK.

Now:
in site/lang/fr/cp.php I have this:
'search_for_anything' => 'Rechercher',

If I have a fr folder in site/lang/, and that I access my site located on a French server from my French IP address, I SHOULD get "Rechercher" at the top of the CP, shouldn't I??

BUT the only thing I get is "Search for anything..."

This is a simple example. But there are litteraly dozens of similar examples, where the keys and their French translation are in my files located in site/lang/fr/ BUT these translations are not displayed in the CP!

Indeed, as I already wrote (see discussion on the lodge about translating 2.0.0), IF I trick Statamic by deleting the en folder locatedin statamic/resources/lang and THEN I put back my fr folder renamed to en I can get MORE translated strings. BUT NOT ALL. Moreover, Nobody should have to do such a trick (I know, it's Halloween soon, but...)

This apply to Assets. Those keys are in my French cp.php file but the French label is never displayed (straight copy from Github, the "pluses" marks are not in the final file):

// Assets
 +    'assets' => 'Ressource|Ressources',
 +    'nav_assets' => 'Ressources',
 +    'new_asset' => 'Nouvelle ressource',
 +    'add_asset' => 'Ajouter une ressource',
 +    'browse_assets' => 'Parcourir les ressources',
 +    'browsing_assets' => 'Consultation des ressources',
 +    'creating_asset' => 'Création d\'une ressource',
 +    'asset_created' => 'Ressource créée',
 +    'editing_asset' => 'Modification d\'une ressource',
 +    'asset_updated' => 'Ressource mise à jour',
 +    'drop_to_upload' => 'Déposer pour télécharger',
 +      'upload_asset' => 'Télécharger une ressource',
 +    'sync_assets' => 'Synchroniser les ressources',
 +    'syncing_assets' => 'Synchro des ressources',     
 +    'new_folder' => 'Nouveau répertoire',
 +    'uploads' => 'Téléchargement|Téléchargements',
 +    'filename' => 'Nom du fichier',
 +    'filesize' => 'Taille du fichier',
 +    'date_modified' => 'Date modifiée',
 +    'parent_folder' => 'Répertoire parent',
 +    'asset_folder_empty_heading' => 'Ce répertoire ne contient aucune ressource.',
 +    'asset_folder_empty' => 'Vous pouvez télécharger de nouvelles ressources dans ce répertoire en glissant-déposant des fichiers sur la zone encadrée ci-dessus.',
 +    'focal_point' => 'Point focal',
 +    'focal_point_label' => 'Cliquez sur l\'image pour ajuster le point focal',
 +    'focal_point_instructions' => 'Le point focal est utilisé lors du rognage de telle sorte que la partie la plus importante de l\'image ne disparaisse pas.',
 +

How can I help you more?

@jasonvarga
Copy link
Member

Did you change your locale to French? Statamic doesn't detect your location or server settings, or anything like that.

Statamic will use the default (first) locale for translating.

You can override the CP locale in cp.yaml. Add locale: fr to translate into fr.

Or, per user, you can also add locale: fr to their user file.

@ebeauchamps
Copy link
Author

ebeauchamps commented Oct 27, 2016

Yes the user has locale: fr and many many other keys are definitely translated when I visit my CP.
But some are not.

Sorry for the server/IP stuff.

@jasonvarga
Copy link
Member

I think I found the issue.

Instead of adding locale to the user file, can you add to cp.yaml instead. Does that work?

@jasonvarga
Copy link
Member

site/settings/cp.yaml

locale: fr

@ebeauchamps
Copy link
Author

ebeauchamps commented Oct 27, 2016

I cannot access my server right now but I can try later on today and let you know
Nice catch, I will do that.

@jasonvarga
Copy link
Member

Looks like that's the issue, and I just fixed it.

Javascript based translations were not taking into account the user's preference. That explains why you were seeing some missing translations.

@ebeauchamps
Copy link
Author

insert big smile here

@jasonvarga
Copy link
Member

Thanks for your patience!

@ebeauchamps
Copy link
Author

Thanks for your understanding and your customer service

@ebeauchamps
Copy link
Author

😃 😺

Adding locale: fr to site/settings/cp.yaml did the trick! I now have a friendly French CP!

We are done to just a handful of untranslated strings:

  • "Algolia Searchable Attributes" in Settings/Search
  • "Add Locale" in Settings/System
  • "Select a field to add" when modifying or creating a Fieldset (dropdown)
  • When modifying an asset (i.e. the black-bear-cubs.jpg image) : "Title", "The display name of the asset.", "Alt Text", "An alternate name for accessibility."
  • and finally a few success green banners (not of much importance in my opinion)

@ebeauchamps
Copy link
Author

One downside of putting locale: fr in cp.yaml, is that you cannot get a CP localized in different languages at the same time (when you both have English and French speaking authors).

Indeed, If I write the above and then if I put locale: en in a user yaml, then the CP is in English for this user, EXCEPT for the keys whose localisation is only base on cp.yaml.

This "one-way only" solution is deceptive. Perhaps can you do something about it in the future?

@jasonvarga
Copy link
Member

I told you here that not reading the user file was a bug, and I've already fixed it for next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants