There is a project that is maintained in a private repository. The project is divided into modules, and in each module there is a file with localization.

The task is to allocate these files in a separate repository for the translator. Ie, so that when changing localization files it would be possible to simply push the files into the repository with translations, and after the translator translates the files, get them back.

And so that at the same time in the repository with translations do not get the files with the code.

How can this be implemented?

  • 2
    take a look git submodules - etki
  • I looked in this direction, but, unfortunately, the translations do not have a separate directory but are mixed together with the program code, i.e. I have a module, it has a separate folder, it contains the module files, including the translation. There is another module, it has its own folder, and its translation file, and so on ... - drm
  • one
    it can hardly be solved without changing the application architecture - etki
  • 3
    If you work under Linux, then you can do the following - create a repository, where only translations are stored. Pick it up with a submodule. And in order that the necessary files were in the right places - to attach them with symlinks. But this is a poorly supported solution. On the other hand, no one bothers to finish the build script so that it copies the translations before the build. - KoVadim
  • KoVadim, yes, most likely this is the only solution - drm

1 answer 1

If, as a way to integrate repositories, we consider a system of git submodules , then at least three options for organizing the structure are possible:

  1. create one repository in which files with translations for your modules will be decomposed into sub-directories like module1 , module2 , etc., and connect it as a git-submodule, for example, to the translations directory in, for example, the root of the main repository.
  2. create several repositories by the number of your modules and connect them as git-submodules to sub-directories in directories with your modules.
  3. create one repository (with the structure as in the first variant) and connect it as a git-submodule to each of the directories with your modules.

In any of these options, you will have to either tinker with the build scripts to indicate the changed paths to the files, or use symbolic links. but with symbolic links, as far as I know, there are some problems in, for example, the ms / windows operating system .


micro instructions for adding git submodules

To add a git repository (located at the url-репозитория ) as a submodule in the current repository (in which there should preferably not be uncommitted changes), run the following command in it:

 $ git submodule add url-репозитория каталог/куда/добавлять 

каталог/куда/добавлять should not exist at the time of the command - it will be created automatically.

after executing this command, the каталог/куда/добавлять and the new (or modified if you have already connected any sub- .gitmodules ) file .gitmodules will be automatically added to the index:

 $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: .gitmodules # new file: каталог/куда/добавлять 

these changes need to be committed. all submodule connected.

If necessary, you can send changes to the “main” repository using the push command. if the “main” repository is used not only by you, then after the pull command in the clones of this repository (with your commit that adds the submodule), you must also execute two commands — submodule init and submodule update :

 $ git submodule init Submodule 'каталог/куда/добавлять' (url-репозитория) registered for path 'путь/куда/добавлять' $ git submodule update Cloning into 'путь/куда/добавлять'... done. Submodule path 'путь/куда/добавлять': checked out 'хэш коммита'