Skip to content

Commit

Permalink
arabic model: perfecto
Browse files Browse the repository at this point in the history
  • Loading branch information
kariminf committed Dec 29, 2018
1 parent 286ce99 commit 44ec852
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 72 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Object-oriented programming for coders

[![Project](https://img.shields.io/badge/Project-OOP4Coders_book-0014A8.svg?style=flat)](https://github.com/kariminf/oop4coders)
[![Project](https://img.shields.io/badge/Project-OOP4Coders_book-0014A8.svg?style=flat)](https://github.com/projeduc/oop4coders)
[![Book License](https://img.shields.io/badge/Book_license-CC--BY--SA_4.0-0014A8.svg?style=flat)](https://creativecommons.org/licenses/by-sa/4.0/)
[![Codes License](https://img.shields.io/badge/Codes_licence-MIT-0014A8.svg?style=flat)](https://opensource.org/licenses/MIT)
[![GitHub release](https://img.shields.io/github/release/kariminf/oop4coders.svg)](https://github.com/kariminf/oop4coders/releases)
[![Github All Releases](https://img.shields.io/github/downloads/kariminf/oop4coders/total.svg)](https://github.com/kariminf/oop4coders/releases)
[![Github Release](https://img.shields.io/github/downloads/kariminf/oop4coders/latest/total.svg)](https://github.com/kariminf/oop4coders/releases/latest)
[![GitHub release](https://img.shields.io/github/release/projeduc/oop4coders.svg)](https://github.com/projeduc/oop4coders/releases)
[![Github All Releases](https://img.shields.io/github/downloads/projeduc/oop4coders/total.svg)](https://github.com/projeduc/oop4coders/releases)
[![Github Release](https://img.shields.io/github/downloads/projeduc/oop4coders/latest/total.svg)](https://github.com/projeduc/oop4coders/releases/latest)

<img align="left" src="img/book.jpeg">

Expand Down
53 changes: 25 additions & 28 deletions book-ar/KodeBookAr.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
\RequirePackage[utf8]{inputenc}
%\RequirePackage[T1]{fontenc}



%\RequirePackage[arabic,english]{babel}
%\RequirePackage{CJKutf8}

Expand Down Expand Up @@ -169,9 +171,9 @@ title={#1}
}

\newenvironment{discussion}{%
\section*{Discussion}
\addcontentsline{toc}{section}{Discussion}
\markright{Discussion}
\section*{\ar{مناقشة}}
\addcontentsline{toc}{section}{\ar{مناقشة}}
\markright{\ar{مناقشة}}
}{%
}

Expand Down Expand Up @@ -280,7 +282,7 @@ title={#1}
\pagenumbering{roman}
\pagestyle{fancy}
\phantomsection
\addcontentsline{toc}{part}{Front Matter}
\addcontentsline{toc}{part}{\ar{التصديرات}}
\fancyhf{} % sets both header and footer to nothing
\fancyfoot[CE, CO]{\thepage}
% \fancyhead{}
Expand All @@ -292,7 +294,7 @@ title={#1}
% \pagenumbering{roman}
% \pagestyle{empty}
\phantomsection
\addcontentsline{toc}{part}{Back Matter}
\addcontentsline{toc}{part}{\ar{الحواشي}}
%\fancyfoot{}
%\fancyhead{}

Expand All @@ -309,7 +311,7 @@ title={#1}

\pagenumbering{arabic}
\phantomsection
\addcontentsline{toc}{part}{Main Matter}
\addcontentsline{toc}{part}{\ar{نص الكتاب}}

\pagestyle{fancy} % Sets fancy header and footer
% \fancyfoot{} % Delete current footer settings
Expand Down Expand Up @@ -371,6 +373,7 @@ title={#1}
\addcontentsline{toc}{section}{Contents}

{
\RTL
\hypersetup{linkcolor=black}
\tableofcontents
}
Expand All @@ -381,6 +384,7 @@ title={#1}
\chapter*{List of figures}
\addcontentsline{toc}{section}{List of figures}
{
\RTL
\hypersetup{linkcolor=black}
\listoffigures
}
Expand All @@ -392,6 +396,7 @@ title={#1}
\chapter*{List of tables}
\addcontentsline{toc}{section}{List of tables}
{
\RTL
\hypersetup{linkcolor=black}
\listoftables
}
Expand Down Expand Up @@ -447,16 +452,6 @@ title={#1}

\setcounter{tocdepth}{1}

\RequirePackage{lettrine}

\renewcommand{\LettrineFontHook}{\color{indigo}\lettrinefont}
\renewcommand{\LettrineTextFont}{\color{indigo}\bfseries}
\setlength{\DefaultNindent}{2pt}
\setlength{\DefaultFindent}{2pt}
\setlength{\DefaultSlope}{0pt}
\setcounter{DefaultLines}{3}
%\renewcommand{\DefaultLraise}{0.05}
\renewcommand{\DefaultLoversize}{0.1}

%\newcommand{\at}{\makeatletter @\makeatother}

Expand All @@ -480,7 +475,6 @@ title={#1}
hidelinks
}

\renewcommand{\lettrine}[2]{##1##2}

\def\merienda{}
\def\quotefont{}
Expand Down Expand Up @@ -517,8 +511,6 @@ title={#1}
\RequirePackage{tabu}
\RequirePackage{wrapfig}

\RequirePackage{arabxetex}
%\usepackage[english]{babel}


\newcounter{coverind}
Expand All @@ -532,12 +524,12 @@ title={#1}
}

\def\replaceit#1 #2\relax{%replace blanks in a string
\textarab{#1}
\ar{#1}\hspace{\arabic{coverind}cm}.
\begingroup
\ifx\relax#2\relax % is #2 empty?
\def\next{\endgroup\endit}% your own end-macro if required
\else
\def\next{\endgroup\\[0.25cm]\hspace{\arabic{coverind}cm}\replaceit#2\relax}%
\def\next{\endgroup\\[0.25cm]\replaceit#2\relax}%
\stepcounter{coverind}%
% \addtocounter{coverind}{5}
\fi
Expand All @@ -548,7 +540,7 @@ title={#1}
\def\@titleFP{}

\def\title#1{
\def\@title{\textarab{#1}}
\def\@title{\ar{#1}}
\def\@titleFP{\replace{#1}}
}

Expand All @@ -560,12 +552,12 @@ title={#1}
\node[inner sep=0] at (current page.center) {\the\@coverimage};
\fi

\node[anchor=north west,minimum width=1cm,minimum height=12cm,fill=indigo] (vline1)
at ([shift={(2cm,-2cm)}] current page.north west)
\node[anchor=north east,minimum width=1cm,minimum height=12cm,fill=indigo] (vline1)
at ([shift={(-2cm,-2cm)}] current page.north east)
{};

\node[anchor=north west, text=indigo,text width =15cm,fill=white,opacity=0.4,text opacity=1,scale=1.5] (title1)
at ([shift={(0.5cm,0cm)}] vline1.north east)
\node[anchor=north east, text=indigo,text width =15cm,fill=white,opacity=0.4,text opacity=1,scale=1.5,align=right] (title1)
at ([shift={(-0.5cm,0cm)}] vline1.north west)
{
\bfseries
\Huge
Expand All @@ -575,16 +567,21 @@ title={#1}
};


\node[text width=8cm,anchor=north west, align=left] at ([shift={(0cm, -.5cm)}] vline1.south west){
\node[anchor=north east, align=left] at ([shift={(0cm, -.5cm)}] vline1.south east){
\bfseries
\Huge
\ifx\isplain\relax\else \color{white}\fi
\@author
};

\node[text=white,text width=8cm,anchor=north west] at ([shift={(-5cm,2cm)}] current page.south east){
\node[anchor=north east] at ([shift={(5cm,2cm)}] current page.south west){
\the\@licenseimage
};
\end{tikzpicture}
}


\RequirePackage{arabxetex}
%\usepackage[english]{babel}

\def\ar#1{\ar{#1}}
2 changes: 1 addition & 1 deletion book-ar/OOPintro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
\chapter{\textarab{مدخل إلى ب. ك. ت.}}

\begin{introduction} %\lettrine[lines=3,findent=8pt]{\normalfont\textcolor{indigo}T}{his}
\lettrine{T}{his} chapter begins by a little history showing \ac{oop}'s origins and meaning.
This chapter begins by a little history showing \ac{oop}'s origins and meaning.
And, of course, the four concepts will be presented using concise definitions so no one gets bored.
Then, some benefits of \ac{oop} can be listed to show why this paradigm gets its fame.
Some may argue that these benefits are just thin air and this paradigm has failed what it promised.
Expand Down
2 changes: 1 addition & 1 deletion book-ar/calls.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
\renewcommand{\UrlFont}{\ttfamily\footnotesize}

\DeclareAcronym{oop}{
short = OOP ,
short = \textarab{ب. ك. ت.} ,
long = Object-oriented programming ,
class = abbrev
}
Expand Down
12 changes: 6 additions & 6 deletions book-ar/classObject.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
\fi
%=====================================================================

\chapter{\textarab{الصنف والكائن}}
\chapter{\ar{الفئة والكائن}}

\begin{introduction}
\lettrine{A}{bstraction} is the first pillar of \ac{oop}.
Abstraction is the first pillar of \ac{oop}.
From a perception of an entity in a system or a context, certain aspects must be retained while others must be ignored.
This entity is represented by a class or a prototype, with a state (attributes) and behavior (methods).
This chapter will present how a class or prototype is implemented in each language.
Expand All @@ -18,7 +18,7 @@ \chapter{\textarab{الصنف والكائن}}
Finally, there are special methods which can be implemented for an object, mostly, inherited from a universal base class.
\end{introduction}

\section{Class declaration}
\section{\ar{تصريح فئة}}

Class declaration in the following examples is self explanatory.
As for prototype-based implementations, a concise explanation must be afforded.
Expand Down Expand Up @@ -70,7 +70,7 @@ \subsection{Ruby}
\lstinputlisting[language={[KB]Ruby}, linerange={3-3,25-25}, style=codeStyle]{../codes/ruby/clsobj/person.rb}


\section{Constructors and destructors}
\section{\ar{دوال البناء ودوال التدمير}}

A constructor is a special function which is responsible for preparing the object to be created.
The preparation, mostly, is concerned by initializing variables or calling some functions.
Expand Down Expand Up @@ -224,7 +224,7 @@ \subsection{Ruby}

\lstinputlisting[language={[KB]Ruby}, linerange={35-35}, style=codeStyle]{../codes/ruby/clsobj/person.rb}

\section{Members}
\section{\ar{الأعضاء}}

There are three types of members:
\begin{itemize}
Expand Down Expand Up @@ -474,7 +474,7 @@ \subsection{Ruby}
end
\end{lstlisting}

\section{Object methods}
\section{\ar{دوال الكائن}}

These are methods inherited from the Object class, or as called by some languages: magic methods.
Most programming languages agree on the following methods:
Expand Down
12 changes: 6 additions & 6 deletions book-ar/copyright.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
% ===================================================
% COPYRIGHT
% ===================================================
\chapter*{Copyright}
\addcontentsline{toc}{section}{Copyright}
\chapter*{\textarab{حقوق النشر}}
\addcontentsline{toc}{section}{\textarab{حقوق النشر}}

\begin{center}
{\Huge \textbf{Object-oriented programming for coders}}
Expand Down Expand Up @@ -73,8 +73,8 @@ \chapter*{Copyright}
% ===================================================
% CREDITS
% ===================================================
\chapter*{Thanks}
\addcontentsline{toc}{section}{Thanks}
\chapter*{\textarab{شكر}}
\addcontentsline{toc}{section}{\textarab{شكر}}

Information retrieval:
\begin{itemize}
Expand Down Expand Up @@ -127,8 +127,8 @@ \chapter*{Thanks}
% VERSIONS
% ===================================================
\newpage
\chapter*{Versions}
\addcontentsline{toc}{section}{Versions}
\chapter*{\textarab{الإصدارات}}
\addcontentsline{toc}{section}{\textarab{الإصدارات}}

\noindent
\begin{itemize}
Expand Down
12 changes: 6 additions & 6 deletions book-ar/encapsulation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
\fi
%=====================================================================

\chapter{\textarab{التعليب}}
\chapter{\ar{التعليب}}

\begin{introduction}
\lettrine{E}{ncapsulation} is an important concept of \ac{oop}.
Encapsulation is an important concept of \ac{oop}.
It is the mechanism of restricting direct access to some members of a class.
It helps managing complexity when the source code is debugged.
If a field is set to be accessed everywhere in a source code, it will be difficult to find errors related to it.
Expand All @@ -19,7 +19,7 @@ \chapter{\textarab{التعليب}}
So, a programming language may fall into one or another.
\end{introduction}

\section{Public members}
\section{\ar{قابلية وصول عامة}}

Public visibility mode is used to access a member of a class everywhere.
Public methods of a class provide an interface that allows them to be called so the object can afford some behavior.
Expand Down Expand Up @@ -148,7 +148,7 @@ \subsection{Ruby}
\lstinputlisting[language={[KB]Ruby}, linerange={6-9,14-14,20-20}, style=codeStyle]{../codes/ruby/encapsulation/app.rb}


\section{Protected members}
\section{\ar{قابلية وصول محمية}}

Protected visibility mode is used to access a member of a class from the class itself and its subclasses.
It is used to allow a class accessing its superclass's members directly.
Expand Down Expand Up @@ -288,7 +288,7 @@ \subsection{Ruby}

\lstinputlisting[language={[KB]Ruby}, linerange={6-6,10-11,17-18}, style=codeStyle]{../codes/ruby/encapsulation/app.rb}

\section{Private members}
\section{\ar{قابلية وصول خاصة}}

Fields are set to be private so they can not be changed directly.
Instead, setters and getters can be used to access them because they are more appropriate for that.
Expand Down Expand Up @@ -451,7 +451,7 @@ \subsection{Ruby}

\lstinputlisting[language={[KB]Ruby}, linerange={3-3,5-6,9-9,19-19}, style=codeStyle]{../codes/ruby/encapsulation/student.rb}

\section{Other visibility modes}
\section{\ar{قابليات وصول أخرى}}

\subsection{C++}

Expand Down
12 changes: 6 additions & 6 deletions book-ar/helloworld.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
%=====================================================================

%Introduction
\chapter{Hello World}
\chapter{\ar{مدخل إلى لغات البرمجة}}

\begin{introduction}

\lettrine{I}{ntroducing} the different \ac{oop} languages used in this book is something which should be done before starting our journey.
Introducing the different \ac{oop} languages used in this book is something which should be done before starting our journey.
First of all, installing instructions must be presented to help anyone with zero knowledge about these languages get staring.
Then, some coding features will be presented from a simple ``Hello world" passing through functions and entry point to exception handling.
It is important to point out that this chapter introduces the basic syntax without diving in different \ac{oop} concepts.
Unless, of course, in case of ``exceptions" which are based on classes in some languages such as Java.
\end{introduction}


\section{Getting started}
\section{\ar{الشروع في العمل}}

To be able to execute the examples afforded in this book, it is strongly recommended to install the languages compilers or interpreters.
Here some instructions on how to get them (``\textbf{Gotta Catch 'Em All}").
Expand Down Expand Up @@ -328,7 +328,7 @@ \subsection{Ruby}
$ ruby helloworld.rb
\end{lstlisting}

\section{Functions}
\section{\ar{الدوال}}

Let's take the factorial function as an example.
We implement the recursive version.
Expand Down Expand Up @@ -412,7 +412,7 @@ \subsection{Ruby}
\lstinputlisting[language={[KB]Ruby}, linerange={9-15}, style=codeStyle]{../codes/ruby/hello/func.rb}


\section{Entry point}
\section{\ar{نقطة الدخول}}

When a program is called from command-line, it searches for a function as entry-point.
This is not the case for all languages; for instance, scripting languages execute without needing one.
Expand Down Expand Up @@ -557,7 +557,7 @@ \subsection{Ruby}
\end{lstlisting}


\section{Exceptions}
\section{\ar{الاستثناءات}}

\subsection{C++}

Expand Down
Loading

0 comments on commit 44ec852

Please sign in to comment.