My software’s language had to be switched from English to Japanese in Docker mysql. My server is ubuntu.

Conclusion

# Dockerfile
RUN apt-get update && apt-get install -y locales \
&& sed -i -e 's/# \(ja_JP.UTF-8\)/\1/' /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=ja_JP.UTF-8

It is possible to replace characters by…

--

--

Basically, while writing ruby codes, I avoid using inheritance because inheritance sometimes produce unnecessary tight couplings.

Example

class Vehicle   
def start_engine
end
def stop_engine
end
end

class Car < Vehicle
def drive
start_engine
stop_engine
end
end

In this case, Car class knows about the codes of Vehicle class. If we create objects that don’t use an engine, it will necessary to take much time to change the codes.

Solution

We should use compositions. In other words, we should define Engine object.

class Car   
def initialize
@engine = Engine.new
end
def drive
@engine.start
@engine.stop
end
end
class Engine
def start
end
def stop
end
end

In this case, Engine class was separated from Car class. Moreover, it has become easy to make new objects that don’t use an engine.

My LinkedIn account is below! Please contact me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/

--

--