How to use localized android library - android

I want to use a github library Android about page in Greek language.
As i can see the library support Greek. Do i need to set localization in my project? (It will be only in Greek language).
I tried adding values-el folder with strings.xml in Greek inside , and add the Greek strings in my values-->strings.xml with no luck.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="about_contact_us">Επικοινωνήστε μαζί μας</string>
<string name="about_instagram">Ακολουθήστε μας στο Instagram</string>
<string name="about_facebook">Κάντε like στην σελίδα μας στο Facebook</string>
<string name="about_play_store">Αξιολογήστε μας στο Play Store</string>
<string name="about_youtube">Παρακολουθήστε μας στο YouTube</string>
<string name="about_twitter">Ακολουθήστε μας στο Twitter</string>
<string name="about_github">Καντε μας fork στο Github</string>
<string name="about_website">Επισκεφθείτε την ιστοσελίδα μας</string>
</resources>
If i need to set localization, whats the easiest way as its the only thing i need translated?

Do i need to set localization in my project ...
No, you don't.
Greek localized strings just will work fine, you should see them without any additional movements if your device's system language is Greek.

Related

Freemarker placeholder in html file in Android IDE Template Format

I'm working with android studio to develop Android app. I'm working on the creation of a template to use in my applications. I have read the Android IDE Template Format specification and so i start my personal template starting from Dummy template.
I have a .ftl file with the following line of code:
<applicationGestureListenerClazz>${projectPackageName}.listeners.${projectShortName}GestureListener</applicationGestureListenerClazz>
When i execute the template i obtain the following line:
<applicationGestureListenerClazz>org.abubu.dummy.listeners.DummyGestureListener
</applicationGestureListenerClazz>
The variables are correctly defined (in other file they work fine). I don't known why.. it add a CRLF after this line.
Anybody has analogue problem?
UPDATE
I discover that the problem is linked to extension of output file. For example. I have a file **license_key_strings.txt.ftl* that contains:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di ${projectPackageName}.key-->
<string name="publicKey">${licenseKey}</string>
</resources>
<!-- fine -->
If i use it to create a xml file
<instantiate from="root/key/src/main/res/values/license_key_strings.txt.ftl" to="${keyBaseDir}/src/main/res/values/license_key_strings.xml"/>
I obtain this file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di org.dummy.key-->
<string name="publicKey">
MIIBIjANBgkqhkiG9w0BAQ
</string>
</resources>
But the output filename ends with .txt
<instantiate from="root/key/src/main/res/values/license_key_strings.txt.ftl" to="${keyBaseDir}/src/main/res/values/license_key_strings.txt"/>
The final output become:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di org.dummy.key-->
<string name="publicKey">MIIBIjANBgkqhkiG9w0BAQ</string>
</resources>
<!-- fine -->
I'm working with Android Studio 1.4

Error while recompiling app string.xml

Facing error while recompiling an app.The app was in chinese so I had decompiled it using Advance apktool translated strings.xml but while recompiling it it giving error log attached.
Log Recorded By : Advanced ApkTool v4.1.0 By BDFreak
Blockqu(skipping file '.picasa.ini' due to ANDROID_AAPT_IGNORE pattern '.')
(skipping dir '.picasaoriginals' due to ANDROID_AAPT_IGNORE pattern '.')
F:\Downloads\Compressed\apkmanager\3-Out\tools.apk\res\values\strings.xml:324: error: Error parsing XML: not well-formed (invalid token)
F:\Downloads\Compressed\apkmanager\3-Out\tools.apk\res\values\public.xml:268: error: Public symbol string/add_screenshot declared here is not defined.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="about_module">about desktop toolbox</string>
<string name="add_screenshot">increase screenshots options</string>
<string name="add_screenshot_summary">screenshots option to increase the power menu</string>
<string name="advanced">advanced</string>
<string name="advanced_reboot_menu">advanced restart menu</string>
<string name="advanced_reboot_menu_summary">add more options to "restart" menu</string>
<string name="all_rotations">enable all the rotation angle</string>
<string name="all_rotations_summary">allow all rotation angle , including upside down</string>
<string name="am_pm_style">am pm style</string>
<string name="am_pm_style_summary">choose am pm style: %s</string>
<string name="app_browser">browser</string>
<string name="app_calendar">calendar</string>
<string name="app_miuigallery">gallery</string>
<string name="app_mms">sms</string>
<string name="app_music">music</string>
<string name="app_phone">phone</string>
<string name="app_quicksearchbox">quick search bar</string>
<string name="app_supermarket">app store</string>
<string name="app_themes">themed</string>
<string name="app_updater">system update</string>
<string name="applications">hide checked icon</string>
<string name="applications_summary">miui system application settings</string>
<string name="apps_notifications">notice</string>
<string name="backup_defaults">restore default</string>
<string name="backup_defaults_restored">the default setting has been restored</string>
<string name="backup_delete">delete</string>
<string name="backup_name">backup name</string>
<string name="backup_no_backups">no backup</string>
<string name="backup_restore">restore settings</string>
<string name="backup_restored">restored backup settings</string>
<string name="backup_restoring">restoring a backup</string>
<string name="backup_save">save settings</string>
<string name="backup_save_error">save error !</string>
<string name="backup_save_successful">successfully saved!</string>
<string name="battery">battery</string>
<string name="battery_icon_color">the battery icon color</string>
<string name="battery_icon_color_summary">setting the battery icon color</string>
<string name="battery_text_color">battery text color</string>
<string name="battery_text_color_summary">battery set text color</string>
<string name="bold_settings_font">set bold text</string>
<string name="bold_settings_font_summary">systems and applications using bold style</string>
<string name="browser_autofit_pages">adaptive page</string>
<string name="browser_autofit_pages_summary">adaptive page option to add the browser</string>
<string name="buttons">button</string>
<string name="buttons_summary">key remapping , keystrokes , etc.</string>
<string name="carrier_label_color">operators label color</string>
<string name="carrier_label_color_summary">setting operators label color</string>
<string name="carrier_settings">operators tag</string>
<string name="clock">clock</string>
<string name="clock_center">center</string>
<string name="clock_center_ios7">center (ios 7 style)</string>
<string name="clock_color_summary">setting the status bar clock color</string>
<string name="clock_color_title">clock color</string>
<string name="clock_date_format">date format</string>
<string name="clock_date_style">date style</string>
<string name="clock_date_style_summary">"select the date style:
%s"</string>
<string name="clock_hide">hide clock</string>
<string name="clock_hide_summary">not in the status bar clock</string>
<string name="clock_left">left</string>
<string name="clock_position">clock position</string>
<string name="clock_position_summary">"choose clock location:
%s"</string>
<string name="clock_right">right home ( default )</string>
<string name="clock_style_hide">hide</string>
<string name="clock_style_large">l</string>
<string name="clock_style_small">s</string>
<string name="cloud_upload_delay">cloud sync delay</string>
<string name="cloud_upload_delay_summary">"new photos synchronized to the delay time before cloud services millet
%s"</string>
<string name="color_for_all_icons">icon color</string>
<string name="color_for_all_icons_summary">the status bar icon color</string>
<string name="common">desktop</string>
<string name="config_folder_columns_count">folder number of icons per row</string>
<string name="config_folder_columns_count_summary">folder number of icons per row after opening: %s</string>
<string name="config_launcher_icons_size">desktop icons / folders size ratio</string>
<string name="config_launcher_icons_size_summary">desktop icons / folders size ratio: %s</string>
<string name="custom_build_prop">device properties</string>
<string name="custom_build_prop_board">board</string>
<string name="custom_build_prop_board_value">ro.product.board</string>
<string name="custom_build_prop_brand">brand</string>
<string name="custom_build_prop_brand_value">ro.product.brand</string>
<string name="custom_build_prop_device">device</string>
<string name="custom_build_prop_device_value">ro.product.device</string>
<string name="custom_build_prop_model">model</string>
<string name="custom_build_prop_model_value">ro.product.model</string>
<string name="custom_build_prop_name">name</string>
<string name="custom_build_prop_name_value">ro.product.name</string>
<string name="custom_build_prop_summary">custom settings build.prop parameters</string>
<string name="custom_carrier_label">custom operators tag</string>
<string name="custom_carrier_logo">operators tag</string>
<string name="custom_carrier_logo_summary">alternative operators use image identification tag</string>
<string name="default_carrier_label">leave blank to use the default carrier tag</string>
<string name="device">rotation</string>
<string name="dialog_color_picker">color picker</string>
<string name="disable_albumart_download">do not download cover</string>
<string name="disable_albumart_download_summary">prohibits automatically download album cover images</string>
<string name="disable_numberpicker_sound">touch sound disable dialpad</string>
<string name="disable_numberpicker_sound_summary">touch sound disable dialpad ( calculator, alarm clock and other tone )</string>
<string name="disable_safe_volume_warning">disabling safe volume warning</string>
<string name="disable_safe_volume_warning_summary">when using headphones to listen to music,disable security warning dialog box volume</string>
<string name="disable_scrolling_cache">scroll cache disabled</string>
<string name="disable_scrolling_cache_summary">"scroll cache disabled list
you might raise some fluency scrolling list"</string>
<string name="disable_sms_to_mms_conversion">allow long sms</string>
<string name="disable_sms_to_mms_conversion_summary">disable automatically converted to mms messages</string>
<string name="disable_volume_control_sound">disable beep sound sound</string>
<string name="disable_volume_control_sound_summary">beep sound sounds when adjusting the volume disabled</string>
<string name="double_click_menu_app">double-click the menu button</string>
<string name="double_click_menu_app_summary">double-click the menu key to start the selected application</string>
<string name="double_tap_menu_action">double-click the menu button behavior</string>
<string name="double_tap_menu_action_summary">%s</string>
<string name="enable_custom_build_prop">use custom property values</string>
<string name="enable_custom_build_prop_summary">"the following parameters will be modified on bootup
build.prop file will not be modified"</string>
<string name="extra_battery_info">additional battery information</string>
<string name="extra_battery_info_summary">add battery power settings information</string>
<string name="festival_update_server">recommended sms update server</string>
<string name="festival_update_server_summary">%s</string>
<string name="fix_screenshot_position">fixed " screenshots " position</string>
<string name="fix_screenshot_position_summary">fixed some screenshots options displacement situation. if you have the option to display normal position , please do not turn this option</string>
<string name="font_size">font size</string>
<string name="font_size_summary">set the status bar text size: %s</string>
<string name="framework">more settings</string>
<string name="framework_summary">more system settings</string>
<string name="gallery_old_videoplayer">using the system player to play video</string>
<string name="gallery_old_videoplayer_summary">miuivideoplayer.apk must be installed in / system / app folder</string>
<string name="headset_notification_icon">hide headset notification icons</string>
<string name="headset_notification_icon_summary">when headphones are plugged in headphones icon is displayed</string>
<string name="hide_alarm_icon">hide the clock icon</string>
<string name="hide_battery_icon">hide the battery icon</string>
<string name="hide_battery_icon_summary">whether to show the battery icon</string>
<string name="hide_carrier_label">hide operators tag</string>
<string name="hide_carrier_label_summary">whether operators tag</string>
<string name="hide_folders_label">hidden folder labels</string>
<string name="hide_folders_label_summary">only hide desktop folder text label</string>
<string name="hide_hotseats_bar">hide the navigation</string>
<string name="hide_hotseats_bar_summary">it allows you to hide desktop navigation bar to get more space arrangement applications</string>
<string name="hide_hotseats_label">hide navigation icon labels</string>
<string name="hide_hotseats_label_summary">only hide the navigation bar at the bottom of the desktop icon labels</string>
<string name="hide_icons_label">hide desktop icon labels</string>
<string name="hide_icons_label_summary">only hide desktop icons for all applications under the text label</string>
<string name="hide_launcher_apps_list">desktop application icon list</string>
<string name="hide_launcher_apps_summary">you can choose to want to hide the icon on the desktop program</string>
<string name="hide_launcher_apps_title">hide the selected icon</string>
<string name="hide_ongoing_ime_switcher">hide input method switcher</string>
<string name="hide_ongoing_ime_switcher_summary">whether to switch the input method notified when entering</string>
<string name="hide_roaming_icon">hide roaming icon</string>
<string name="holidays_selector_country">country holidays</string>
<string name="holidays_selector_country_belarus">belarus ( belarus)</string>
<string name="holidays_selector_country_czech">czech republic(czech republic)</string>
<string name="holidays_selector_country_kazakhstan">kazakhstan(kazakhstan()</string>
<string name="holidays_selector_country_original">default ( china )</string>
<string name="holidays_selector_country_poland">poland ( poland )</string>
<string name="holidays_selector_country_russia">russia(russia)</string>
<string name="holidays_selector_country_slovakia">slovakia ( slovakia )</string>
<string name="holidays_selector_country_summary">%s</string>
<string name="holidays_selector_country_turkmenistan">turkmenistan ( turkmenistan )</string>
<string name="holidays_selector_country_ukraine">ukraine(ukraine)</string>
<string name="holidays_update_server">holidays updated server</string>
<string name="holidays_update_server_summary">%s</string>
<string name="international_t9">t9 search add</string>
<string name="international_t9_summary">enabling contacts international t9 search</string>
<string name="key_menu">menu (menu)</string>
<string name="key_volume">volume keys</string>
<string name="launch_playback_screen">start the player interface</string>
<string name="launch_playback_screen_summary">click start to play music when pop pendant interface . by default, the player opens the main interface</string>
<string name="launcher">desktop</string>
<string name="launcher_font_size">desktop icons / folders text size</string>
<string name="launcher_font_size_summary">desktop icons / folders label text size : %s</string>
<string name="launcher_icons_color">select the icon / folder label color</string>
<string name="launcher_icons_color_summary">select the desktop icon / folder label text color</string>
<string name="launcher_summary">desktop -related settings</string>
<string name="local_yellowpage_database">local yellow pages database</string>
<string name="local_yellowpage_database_dialog">"china pages database will be cleared.
you need to restart the update t9 index data in the contacts settings.
you want to continue?"</string>
<string name="local_yellowpage_database_summary">yellow shield china from the server to update and increase contacts marked unknown function</string>
<string name="localized_measure_units">localization number of units</string>
<string name="localized_measure_units_summary">"• status bar : network speed (kb / s, mb / s)
• task manager: cleared, available memory (mb, gb)
• data flow : b, kb, mb, gb"</string>
<string name="lockscreen_rotations">enable lock screen rotation</string>
<string name="lockscreen_rotations_summary">allows lock screen rotation to landscape mode</string>
<string name="long_press_menu_action">press the menu key behavior</string>
<string name="long_press_menu_action_summary">%s</string>
<string name="long_press_track_skip">volume keys jump track</string>
<string name="long_press_track_skip_summary">when the screen is turned off long press the volume key to jump track</string>
<string name="menu_action_custom_app">start the custom applications</string>
<string name="menu_action_default">default</string>
<string name="menu_action_previous_app">the launch of an application</string>
<string name="menu_action_sleep">lock screen</string>
<string name="menu_action_torch">flashlight</string>
<string name="mitools_copyright">"any module modifications prohibited.
burgerz md, copyright © 2015, all rights reserved"</string>
<string name="miwarning_close">drop out</string>
<string name="miwarning_continue">carry on</string>
<string name="miwarning_message">"some models use this program may be no effect, or some features can not be used .
you want to continue?"</string>
<string name="miwarning_title">welcome to the program</string>
<string name="mms_unicode_stripping">normalization unicode</string>
<string name="mms_unicode_stripping_all">remove all unicode character</string>
<string name="mms_unicode_stripping_leave_intact">remains intact</string>
<string name="mms_unicode_stripping_non_encodable">unable to remove the encoded characters</string>
<string name="mms_unicode_stripping_summary">"will unicode character is converted to an ordinary character
mode: %s
( yet) does not work on some devices!"</string>
<string name="module_desc">"miui6hide icons , modify the label color
[click here to enter the settings take effect after restart]"</string>
<string name="module_desc_full">"miui6desktop toolbox
the desktop toolbox can hide desktop icons, labels , modify the icon size text color and other functions."</string>
<string name="module_name">desktop toolbox</string>
<string name="multiline_labels">multiple lines icon / folders tab</string>
<string name="multiline_labels_summary">multi-line desktop icons / folders tag</string>
<string name="national_roaming">domestic data roaming</string>
<string name="national_roaming_summary">but open domestic roaming data services</string>
<string name="navigation_bar">navigation bar</string>
<string name="navigation_bar_color">navigation bar color</string>
<string name="navigation_bar_color_summary">navigation bar background color</string>
<string name="navigation_bar_height">navigation bar height</string>
<string name="navigation_bar_height_landscape">the height of the navigation bar</string>
<string name="navigation_bar_height_summary">height : %s</string>
<string name="navigation_bar_override">override default</string>
<string name="navigation_bar_override_summary">navigation bar adjustment</string>
<string name="navigation_bar_width">navigation bar width</string>
<string name="network_speed_exp_statusbar">current network speed</string>
<string name="network_speed_exp_statusbar_summary">the status bar displays the current network speed</string>
<string name="none">(no)</string>
<string name="notif_reboot">reboot</string>
<string name="notif_reboot_required">restart for the changes to take effect</string>
<string name="notif_reboot_required_message">you need to restart to apply changes</string>
<string name="notif_reboot_required_title">need to restart</string>
<string name="notif_soft_reboot">soft reboot</string>
<string name="notif_torch_on">flashlight</string>
<string name="notification_bubble_apps">application list</string>
<string name="notifications">notice</string>
<string name="one_color_for_all_icons">all icons single color</string>
<string name="one_color_for_all_icons_summary">let all the icons on the status bar using a single color</string>
<string name="own_carrier_logo">select custom logo</string>
<string name="own_carrier_logo_2">select custom identified logo</string>
<string name="own_carrier_logo_summary">%s</string>
<string name="power">about</string>
<string name="power_cancel">cancel</string>
<string name="power_reboot">reboot</string>
<string name="power_reboot_bootloader">reboot into the brush machine mode (fastboot)</string>
<string name="power_reboot_hot">quick restart</string>
<string name="power_reboot_normal">normal restart</string>
<string name="power_reboot_options">restart menu</string>
<string name="power_reboot_recovery">reboot into recovery mode (recovery)</string>
<string name="power_reboot_switch_system">switching system ( millet phone only)</string>
<string name="power_reboot_system_1">reboot the system</string>
<string name="power_reboot_system_2">reboot the system two</string>
<string name="preference_app_picker_search">search applications</string>
<string name="press_color_to_apply">tap the color to apply</string>
<string name="quicksearchbox_marketplace">search market</string>
<string name="quicksearchbox_marketplace_summary">"search for the following markets :
%s"</string>
<string name="screenshot_delay">screenshot delay ( ms)</string>
<string name="select_carrier_logo">select identity</string>
<string name="select_carrier_logo_2">select identify two</string>
<string name="select_carrier_logo_summary">%s</string>
<string name="set_launcher_icons_color">select the icon / folder label color</string>
<string name="set_launcher_icons_color_summary">use custom icons / folders label color</string>
<string name="show_battery_text">icon appears next to the text</string>
<string name="show_battery_text_summary">display battery percentage</string>
<string name="show_navigation_bar">show navigation bar</string>
<string name="show_navigation_bar_summary">within the display screen buttons (nexus style )</string>
<string name="show_notification_bubble">display notification bubble</string>
<string name="show_notification_bubble_summary">bubble notification is displayed on the application's icon</string>
<string name="signal_bars_color">signal color</string>
<string name="signal_bars_color_2">signal color two</string>
<string name="signal_bars_color_summary">setting the mobile network signal indicator color</string>
<string name="signal_bars_color_summary_2">setting the mobile network signal indicator color ( card b)</string>
<string name="sound">voice</string>
<string name="sound_summary">voice -related settings</string>
<string name="statusbar">status bar</string>
<string name="statusbar_background_color">background color</string>
<string name="statusbar_background_color_summary">the status bar background color</string>
<string name="statusbar_common">general options</string>
<string name="statusbar_set_background_color">change the background color</string>
<string name="statusbar_set_background_color_summary">allows background color modify the status bar</string>
<string name="statusbar_summary">modify status bar</string>
<string name="statusbar_text_family">font style</string>
<string name="statusbar_text_family_summary">select the status bar font style : %s</string>
<string name="statusbar_text_style">font style</string>
<string name="statusbar_text_style_summary">select the status bar font style: %s</string>
<string name="supermarket_disable_autoupdates_check">disable check for updates</string>
<string name="supermarket_disable_autoupdates_check_summary">disable the automatic check for updates</string>
<string name="supermarket_reverse_tabs_order">reverse tab order</string>
<string name="supermarket_reverse_tabs_order_summary">tags will modify order: management , classification , ranking , fine</string>
<string name="swap_long_press_skip_keys">switching button</string>
<string name="swap_long_press_skip_keys_summary">when switching tone skip track</string>
<string name="take_screenshot">screenshots</string>
<string name="text_large">large</string>
<string name="text_medium">in</string>
<string name="text_small">small</string>
<string name="themes_replace_lunar_dates">replace lunar date</string>
<string name="themes_replace_lunar_dates_summary">try to find topic lunar date and replaced by the gregorian calendar ( lock screen )</string>
<string name="themes_reverse_tabs_order">reverse tab order</string>
<string name="themes_reverse_tabs_order_summary">tags will modify order: i , classification , ranking , fine</string>
<string name="time_10_min">10 minutes</string>
<string name="time_1_hour">1 hour</string>
<string name="time_1_min">1 min (default )</string>
<string name="time_30_min">30 minute</string>
<string name="time_30_sec">30 second</string>
<string name="time_5_min">5 minute</string>
<string name="typeface_family_condensed">compact</string>
<string name="typeface_family_light">lighter</string>
<string name="typeface_family_regular">usually</string>
<string name="typeface_family_thin">fine</string>
<string name="typeface_style_bold">bold face</string>
<string name="typeface_style_italic">italic type</string>
<string name="typeface_style_normal">general</string>
<string name="units_b">b</string>
<string name="units_gb">gb</string>
<string name="units_kb">kb</string>
<string name="units_kbs">kb/s</string>
<string name="units_mb">mb</string>
<string name="units_mbs">mb/s</string>
<string name="units_s">s</string>
<string name="unlink_notification_volume">volume settings are not synchronized</string>
<string name="unlink_notification_volume_summary">separate ringtones & amp; notice the volume settings</string>
<string name="updater_disable_autoupdates_check">disable check for updates</string>
<string name="updater_disable_autoupdates_check_summary">disable the automatic check for updates</string>
<string name="updater_english_changelog">display english update log</string>
<string name="updater_english_changelog_summary">english forced display update log</string>
<string name="use_own_carrier_logo">custom operator identification</string>
<string name="use_own_carrier_logo_summary">you can choose your own carrier logo</string>
<string name="vol_key_cursor">volume keys cursor control</string>
<string name="vol_key_cursor_reverse">switching button</string>
<string name="vol_key_cursor_reverse_summary">exchange volume keys control the cursor when</string>
<string name="vol_key_cursor_summary">use the volume keys to control the cursor input</string>
<string name="volume_notification_description">notice</string>
<string name="volume_ring_description">ring</string>
<string name="volume_step">volume step</string>
<string name="volume_steps_alarm">alarm volume</string>
<string name="volume_steps_bluetooth">bluetooth volume</string>
<string name="volume_steps_music">music volume</string>
<string name="volume_steps_notification">notification volume</string>
<string name="volume_steps_ring">ringer volume</string>
<string name="volume_steps_system">media volume</string>
<string name="volume_steps_voice_call">call volume</string>
<string name="preference_app_picker_none">(no)</string>
<string name="show_clock_date">show status bar date</string>
<string name="show_clock_date_summary">in the status bar next to the clock display date</string>
<string name="holidays_selector_country_german">germany</string>
<string name="statusbar_title">status bar</string>
</resources>
Obviously, you have an error at strings.xml at line #324
This is that line:
<string name="unlink_notification_volume_summary">separate ringtones & amp; notice the volume settings</string>
you have an unnecessary space between & and amp;.

Android how to Convert iOS strings file to Android XML

I have ios string file that i want to convert into the Android xml file:
This is the ios string file which i have want to convert into the Android xml file:
/*
Localizable.strings
SaiÌda da Escola
Created by farhan shah on 11/12/2013.
Copyright (c) 2013 whizpool. All rights reserved.
*/
"settings_button" = "Settings";
"location" = "Destiny";
"Register_button" = "Register";
"logout" = "Log Out";
"login_button" = "Login";
"ok" = "Ok";
"yes" = "Yes";
"no" = "No";
the result should be like this like Android xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Localizable.strings
SaiÌda da Escola
Created by farhan shah on 11/12/2013.
Copyright (c) 2013 whizpool. All rights reserved.
-->
<string name="settings_button">Settings</string>
<string name="location">Destiny</string>
<string name="register_button">Register</string>
<string name="logout">Log Out</string>
<string name="login_button">Login</string>
<string name="ok">Ok</string>
<string name="yes">Yes</string>
<string name="no">No</string>
</resources>
any help,idea and sample code will be highly appreciated,Thanks alot in advance.
You can take a look at the JavaScript code in the page below, and you could do something similar in Java. It uses regular expressions to parse the input files.
http://members.home.nl/bas.de.reuver/files/stringsconvert.html
You cannot convert this "programatically" using Android code, because those strings need to be available in your project's resources before compilation, of course.
You could use a simple bash script, like:
echo '<?xml version="1.0" encoding="utf-8"?>'
echo '<resources>'
while read line ; do
tag=$(echo $line | cut -d'"' -f2)
trad=$(echo $line | cut -d'"' -f4)
echo " <string name=\"$tag\">$trad</string>"
done < <(cat Localizable.strings | egrep '^".+"\s?=\s?.+$')
echo '</resources>'
That outputs:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="settings_button">Settings</string>
<string name="location">Destiny</string>
<string name="Register_button">Register</string>
<string name="logout">Log Out</string>
<string name="login_button">Login</string>
<string name="ok">Ok</string>
<string name="yes">Yes</string>
<string name="no">No</string>
</resources>
Use it like:
$ bash strings.bash > strings.xml
Note: Everything there is just an example I coded in a minute, adapt as you wish.

Appcelerator Titanium Internationalization not working right

Here's one that's driving me crazy:
I have recently started looking into Appcelerator Titanium. I have built a few small apps both with a normal project and using Alloy so I understand the basics at least.
One thing I just cannot get working is the i18n folder/files.
Here is what ive done:
- Create a "Default Project"
- add folder to root directory "i18n"
- add "en" and "es" folder to "i18n"
- add "strings.xml" to both those new folders.
- added:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome TEST</string>
</resources>
to both the strings.xml, except in the es strings I put "ES Welcome TEST".
- In Resources -> app.js I changed "I am Window 1" to L('welcome_message')
- Ran the application
Both the normal and alloy versions just show a blank screen. I would like to get my alloy app working the most but from what I understand the localization code should work the same in both apps. In alloy I may just have to put it in the style.
Any pointers would be great! I have looked at other post claiming its not working but all of them were either syntax errors or just set it up wrong. I have copied their code and have the exact same issue with it not working so I have a feeling im missing a newbie step.
-- Here are some screenshots, I just created a brand new regular(not alloy) project, added the code above and try to use L('welcome_message') to no luck. I tried installing everything on a new PC to make sure I wasn't messing anything up on my main computer.
Heres the answer:
https://wiki.appcelerator.org/display/guides/Internationalization
Ends up by default your manifest file is not setup by default to allow localization UNLESS you choose a tabbed project.
Kinda silly if you ask me.
For the topic poster:
My new string.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Don't Help Austin</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
Screenshot of my non-Alloy experiment:
For those looking to answer the question in the topic, this is a possible answer below.
My i18n folder is on the same hierarchy level as app and plugins, so mine isn't inside the app folder like the rest of the Alloy resources.
index.xml
<Alloy>
<Window class="container">
<Label id="label" onClick="doClick"></Label>
</Window>
</Alloy>
index.tss
".container": {
backgroundColor:"white"
},
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000",
text: L("welcome_message")
}
strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome to Kitchen Sink for Titanium</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
When I placed the L("welcome_message") inside the index.xml, it didn't work.

Android: XML resources (values)

I must make a few translations for my app.
But when I compile my app, console write:
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] W/ResourceType( 4892): Bad XML block: header size 297 or total size 0 is larger than data size 0
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] C:\Users\Roman\Desktop\NewTimer\NewTimer\res\values-fr\strings.xml:6: error: Found text "
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] В В В В  " where item tag is expected
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">CTimer</string>
<!--RUS strings-->
<!--MainForm-->
<string name="main_form_sec">Chronomètre</string>
     <string name="main_form_tim"> Minuterie </string>
     <string name="main_form_set"> Paramètres </string>
<string name="main_form_bg">#000000</string>
<!--Menu-->
<string name="menu_about">À propos du programme</string>
<string name="menu_buy">Supprimer les annonces</string>
<!--Preferences(Settings)-->
Most probably you have a problem with the encoding, resource files are supposed to be encoded in UTF-8.
Please, try to replace "Chronomètre" with something in plain English and see if your error disappears or moves to the next "translated" line.
It's better to use colors.xml for colors:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="main_form_bg">#000000</color>
</resources>

Categories

Resources