Skip to content

Commit bfa8367

Browse files
authored
Disable doc-ro in languages.php and document core.autocrlf usage (#248)
* Disable doc-ro on languages.php and document core.autocrlf usage * git add --renormalize does net revert on Windows, comment tweaks. * Keep documented repositories, false/false to inactive a language.
1 parent 8a84c0a commit bfa8367

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

docs/local-setup.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Setting up a local development environment
22

3-
This guide assumes that you are comfortable working with on the
3+
This guide assumes that you are comfortable working on the
44
command line with tools like Git.
55

66
There are instructions for building [with Docker](#with-docker) or
@@ -10,10 +10,10 @@ will be building with a version of PHP that is known to work.
1010

1111
When working with multiple translations, or working on changes that may
1212
also require changing files in the `doc-base` or `phd` repositories, the
13-
suggested way to organize the local enviroment is to clone repositories
13+
suggested way to organize the local environment is to clone repositories
1414
into a single `phpdoc` directory, and for individual languages to be cloned
1515
into directories named `{LANG}` instead of `doc-{LANG}` as they are named
16-
on GitHub.
16+
on GitHub. See `doc-base/languages.php` script to automate this process.
1717

1818
<a name="with-docker"></a>
1919
## Building with make and Docker
@@ -38,7 +38,7 @@ building, otherwise the latest revision of those repositories from GitHub
3838
will be built into the Docker image used.
3939

4040
To force the Docker image used for building to itself be rebuilt, run
41-
`make -B build`, otherwise the `Makefile` will only build it if does not
41+
`make -B build`, otherwise the `Makefile` will only build it if it does not
4242
already exist.
4343

4444
The web version of the documentation with `make php` and the output will
@@ -103,3 +103,34 @@ To build the version for the website (with a [local web setup](local-web-setup.m
103103
$ php phd/render.php --docbook doc-base/.manual.xml --package PHP --format php
104104
$ open https://localhost:8080/manual/en/
105105
```
106+
107+
<a name="windows-eol"></a>
108+
## Translating on Windows
109+
110+
When working on Windows, try to use text editors that preserve the end
111+
of line mark as `U+000A LINE FEED (LF)` only. If it's not possible,
112+
you may issue the commands below to instruct `git` in transforming
113+
the files in your local clone to use the Windows native end of line
114+
mark:
115+
116+
```
117+
cd LANG
118+
git config core.autocrlf true
119+
git add --renormalize .
120+
git status
121+
```
122+
123+
If the last comment above outputs no files, then the process works,
124+
and you can start translating.
125+
126+
If the last command above shows a list of files, something went wrong,
127+
because these listed files will be changed at *repository level*
128+
in the next commit. There should be *none*. If any files are listed,
129+
revert the changes with commands below and open an issue on
130+
`doc-base` repository.
131+
132+
```
133+
git config --unset core.autocrlf
134+
git reset
135+
git status
136+
```

languages.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
+------------------------------------------------------------------------------+
1717
*/
1818

19-
// dir manual revcheck cloneUrl label
20-
19+
// Languages repositories on GitHub
20+
// dir manual revcheck cloneUrl label
2121
lang( "de" , true , true , "[email protected]:php/doc-de.git" , "German" );
2222
lang( "en" , true , false , "[email protected]:php/doc-en.git" , "English" );
2323
lang( "es" , true , true , "[email protected]:php/doc-es.git" , "Spanish" );
@@ -26,7 +26,7 @@
2626
lang( "ja" , true , true , "[email protected]:php/doc-ja.git" , "Japanese" );
2727
lang( "pl" , false , true , "[email protected]:php/doc-pl.git" , "Polish" );
2828
lang( "pt_BR" , true , true , "[email protected]:php/doc-pt_br.git" , "Brazilian Portuguese" );
29-
lang( "ro" , false , true , "[email protected]:php/doc-ro.git" , "Romanian" );
29+
lang( "ro" , false , false , "[email protected]:php/doc-ro.git" , "Romanian" );
3030
lang( "ru" , true , true , "[email protected]:php/doc-ru.git" , "Russian" );
3131
lang( "tr" , true , true , "[email protected]:php/doc-tr.git" , "Turkish" );
3232
lang( "uk" , true , true , "[email protected]:php/doc-uk.git" , "Ukrainian" );
@@ -70,8 +70,11 @@ function print_usage()
7070

7171
function lang( string $code , bool $manual , bool $revcheck , string $cloneUrl , string $label )
7272
{
73-
$lang = new Lang( $code , $manual , $revcheck , $cloneUrl , $label );
74-
Conf::$knowLangs[ $code ] = $lang;
73+
if ( $manual || $revcheck )
74+
{
75+
$lang = new Lang( $code , $manual , $revcheck , $cloneUrl , $label );
76+
Conf::$knowLangs[ $code ] = $lang;
77+
}
7578
}
7679

7780
class Conf

0 commit comments

Comments
 (0)