project_files/HedgewarsMobile/Classes/LabelWithIBLocalization.m
branchios-revival
changeset 11227 0dd98551e3f8
equal deleted inserted replaced
11226:628ac6f8a41e 11227:0dd98551e3f8
       
     1 /*
       
     2  * Hedgewars-iOS, a Hedgewars port for iOS devices
       
     3  * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
       
    17  */
       
    18 
       
    19 #import "LabelWithIBLocalization.h"
       
    20 
       
    21 @interface LabelWithIBLocalization ()
       
    22 @property (nonatomic) BOOL isAlreadyLocalized;
       
    23 @end
       
    24 
       
    25 @implementation LabelWithIBLocalization
       
    26 
       
    27 - (void)layoutSubviews
       
    28 {
       
    29     [super layoutSubviews];
       
    30     
       
    31     if (!self.isAlreadyLocalized)
       
    32     {
       
    33         // Text which set in Interface Builder used here as a key for localization
       
    34         self.text = NSLocalizedString(self.text, nil);
       
    35         
       
    36         [self setNeedsLayout];
       
    37         self.isAlreadyLocalized = YES;
       
    38     }
       
    39 }
       
    40 
       
    41 @end