~fedevera/pictogame/Pictogame

« back to all changes in this revision

Viewing changes to picto/app/interfaces/Localizable.java

  • Committer: Federico Vera
  • Date: 2011-11-20 21:23:28 UTC
  • Revision ID: dktcoding@gmail.com-20111120212328-eqbxb8kth9hxs3zw
FirstĀ codeĀ upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *                      ..::PictoGame::..
 
3
 *
 
4
 * Copyright (C) Federico Vera 2010-2011 <dktcoding [at] gmail>
 
5
 *
 
6
 * PictoGame is free software: you can redistribute it and/or modify it
 
7
 * under the terms of the GNU General Public License as published by the
 
8
 * Free Software Foundation, either version 3 of the License, or any later
 
9
 * version.
 
10
 *
 
11
 * PictoGame is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 * See the GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along
 
17
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
package picto.app.interfaces;
 
21
 
 
22
/**
 
23
 * This interface contains the two basic methods to localize the application.
 
24
 * <br>Basically every object that will be dynamically localized should
 
25
 * implement this interface, BUT if the object can't be localized dynamically
 
26
 * then instead of implementing Localizable it simply must use the
 
27
 * "<code>static import picto.utils.Text._;</code>" this way the object will be
 
28
 * created with localized texts, but those texts can't be changed during the
 
29
 * objects life time, this makes sense when the objects impede access to the
 
30
 * "<code>Edit->Locale</code>" menu items, such as dialogs, error messages, in
 
31
 * short any <code>modal == true</code> window.
 
32
 *
 
33
 * @author Fido <dktcoding [at] gmail>
 
34
 */
 
35
public interface Localizable extends Locales{
 
36
    /**
 
37
     * This method is called in order to update all the localizable
 
38
     * texts in the application, so it should contain all the necessary
 
39
     * things to change the language without bothering the user
 
40
     * (i.e. no restarting, closing, etc.). The best way to accomplish this
 
41
     * is using a static import of the _ method in the text class:<code> static
 
42
     * import picto.utils.Text._;</code>
 
43
     * @see picto.utils.Text
 
44
     */
 
45
    public void updateTexts();
 
46
 
 
47
    /**
 
48
     * This method should be called from the constructor of the classes
 
49
     * that implement this interface, the idea is to create a weak reference
 
50
     * of every localizable object in order to change the localization from
 
51
     * all the available forms at once.<br>
 
52
     * The implementation of the method should be a single line like this one:
 
53
     * <pre>               <code> Text.addWeakReference(this);</code></pre>
 
54
     * The default package of this class is: <code>picto.utils.Text</code>
 
55
     * @see picto.utils.Text
 
56
     */
 
57
    public void addWeakReference();
 
58
 
 
59
}