Added drush command for import config po file.

Created on 8 April 2024, about 1 year ago

Problem/Motivation

Currently there ar en o drush commands for this module.

Proposed resolution

Add similar command to locale
'locale:check'
'locale:clear-status'
'locale:update'
'locale:export'
'locale:import'
'locale:import-all'

Remaining tasks

Currently added a patch for the import command "config_translation_po:import" as it was needed for a project I am working on.
All commands should be added.

โœจ Feature request
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ท๐Ÿ‡ดRomania alexandru.dumitru Cluj

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @alexandru.dumitru
  • Assigned to Vighneshh
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary dj1999
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark rimi@aarhus.dk

    rimi@aarhus.dk โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ญ๐Ÿ‡บHungary dj1999

    Needs working on coding standard.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark rimi@aarhus.dk

    Good point. I've cleaned up and defined coding standards.

    I'm new to actually contributing to a Drupal module, so please let me know if anything must be done differently.

  • ๐Ÿ‡ญ๐Ÿ‡บHungary dj1999
  • Merge request !6Resolve #3439416 "Added drush command" โ†’ (Open) created by ressa
  • Issue was unassigned.
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    This is great, both that there is a module which offers export and import of translated configuration, but also that a Drush command is close to being available.

    The patch worked well for me (I created an MR to get a patch to test) the only thing I would suggest is perhaps add a few examples, like there is in the locale:export and locale:import commands?

    EXPORT

    $ drush locale:export -h
    Exports to a gettext translation file.
    
    See Drupal Core: \Drupal\locale\Form\ExportForm::submitForm
    
    Examples:
     drush locale:export nl > nl.po                           Export the Dutch translations with all types.       
     drush locale:export nl --types=customized,not-customized Export the Dutch customized and not customized      
    > nl.po                                                   translations.                                       
     drush locale:export --template > drupal.pot              Export the source strings only as template file for 
                                                              translation.                                        
    
    Arguments:
     [langcode] The language code of the exported translations. 
    

    IMPORT

    $ drush locale:import -h
    Imports to a gettext translation file.
    
    Examples:
     drush locale-import nl drupal-8.4.2.nl.po     Import the Dutch drupal core translation.                           
     drush locale-import --type=customized nl      Import the Dutch drupal core translation. Treat imported strings as 
    drupal-8.4.2.nl.po                             custom translations.                                                
     drush locale-import --override=none nl        Import the Dutch drupal core translation. Don't overwrite existing  
    drupal-8.4.2.nl.po                             translations. Only append new translations.                         
     drush locale-import --override=not-customized Import the Dutch drupal core translation. Only override             
    nl drupal-8.4.2.nl.po                          non-customized translations, customized translations are kept.      
     drush locale-import nl custom-translations.po Import customized Dutch translations and override any existing      
    --type=customized --override=all               translation.                                                        
    
    Arguments:
     langcode The language code of the imported translations.                                     
     file     Path and file name of the gettext file. Relative paths calculated from Drupal root. 
    

    It doesn't have to be as many examples, but 2-3 maybe? Also, I think the odd path situation should be mentioned, where the two commands are "rooted" -- for export in the current folder, but import uses /web.

    I added a new section "Deploying Drupal interface translations with Drush" on "Translating site interfaces" the other day, and a similar section for
    "Translating configuration" just now, since I could have really used a mention, when I visited that page the other day. Perhaps they can be used for inspiration?

  • ๐Ÿ‡ญ๐Ÿ‡บHungary dj1999
Production build 0.71.5 2024